If I create a file that looks like this for example,
car 2 4 6 8
truck 1 2 3 4 5 6
plane 4 5 6 7 9
Whenever I go to open it back up like this,
ifstream inputFile;
string line;
inputFile.open("file.txt");
while (inputFile>>line)
{
cout << line << endl;
}
inputFile.close();
return 0;
}
It displays output like this,
car
2
4
6
8
How can I get it to display like above?