Ok so I'm trying to retrieve an integer from the file reference1.txt but every time it keeps failing to retrieve it and outputting -858993460. The rest of the code functions great, it's just this part which doesn't seem to work. Any help?
The above code would be better of reading a file by not using a for loop, and instead reading a file until there is something in the file, for example:
1 2 3 4 5 6
string input;
while (!myfile.eof())
{
getline(myfile, input);
}
myfile.close()
I've tried that and something like it before but it doesn't seem to allow me to retrieve integers for use later on, hence why I switched to the for loop.