我有这种格式的文本文件
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;
}
}