Hi
I am trying to read numbers from a file using getline.My main aim is to read the first number and store the number zombies struct as the number of zombies .The second and third stores the health and distance respectively.
if the file has 2 4 5 7 6
then there a 2 zombies, the first has a health of 4 and distance of 5.the secong a health of 7 and a distance of 6.
maybe try while( !inFile.eof() ) instead of yours because you never actually set end to be true or false and then you are saying when it is false then to do the loop. and never actually set it equal to true at the end.
the while loop is not a problem, the problem is using the getline function to retrive data from a file.
Even if i change the loop is still det an error
i get this error
" error: no matching function for call to ‘getline(std::ifstream&, int&)’"
That error is saying that you are using an int variable, zombieCount, when the function needs a string variable. You will have to create a string variable and then convert to int/double.
You can also put in a third part if you wanted to stop at a space or a new line getline(inFile, zombieString, '\n');