I have been looking for a good approach to solve this issue, but many examples are when words are separated by spaces and it makes a solution easier, like in this example:
ifstream fin(“marks.txt”);
string name;
int var1;
int var2;
int var3;
while (fin >> name >> var1 >> var2 >> var3)
{
/* do something with name, var1 etc. */
cout << name << var1 << var2 << var3 << “\n”;
}
but what if my file has the following:
word1,word2,word3,word4,word5
word6,word,word,word,word,word
How should implement a code for this! I will appreciate any help, newbie in c++ Thanks in advance
Aucun commentaire:
Enregistrer un commentaire