Okay, so I have a program that reads in a .txt file.
Here is the sample contents of the .txt file:
1 load grades.csv
2 save grades.csv
3 show all
I have it read in as a string command
. In line 1 am able to read the command load
in just fine(the command reads the grades.csv
file), same goes for the save
command. But for the next line I am not sure how to read the show all
command as one word.
This is what I have as code:
if (command == load)
{
in.ignore();
cout << "load" << endl;
}
else if (command == "show all") //this is the error, it only reads in **save**
cout << "show" << endl;
else
cout << "save" << endl;
This is running in the while loop. I feel like I have to use the ignore()
function but I am not sure how I can implement that in the if-else statement.
Thanks