У меня есть текстовый файл в этом форматеC++ чтение из файла пропустить определенные строки
wins = 2
Player
10,45,23
90,2,23
я должен хранить 10 45 23 в вектор и передать его функции, это проблема распадается после первой строки
string csvLine;
int userInput;
ifstream data("CWoutput.txt");
string line;
string str;
vector<string> listOfScores;
while(getline(data,line))
{
stringstream lineStream(line);
string cell;
while(getline(lineStream,cell,'\n'))
{
if (cell.at(0) != 'w' || cell.at(0) != 'P')
{
while(getline(lineStream,cell,','))
{
cout<<line<<endl;
listOfScores.push_back(cell);
}
}
}
vector<transaction> vectorScores= this->winner(listOfCells);
bool hasWon= false;
hasWon= this->validateRule2(vectorScores);
if(hasWon== true)
{
return true;
}
else
{
return false;
}
}
Помимо всего прочего, пожалуйста, замените 'если (hasWon == TRUE) {возвращает истину; } else {return false; } 'с' return hasWon; '. – BoBTFish
yes или прямо 'return this-> validateRule2 (vectorScores)' –
Или 'return this-> validateRule2 (this-> winner (listOfCells))' –