so I have a file for C++ that I am reading in. It has 3 ints 4 4 16
looks like that. I'm curious as to how I go about getting this all read into 3 variables that I have cars carCapacity people
I have set up two different ways of trying to get them but neither are working. I just get an infinite loop
fin >> cars >> carCapacity >> people;
Is one way that I'm trying to store the input. another was:
fin >> cars;
fin >> carCapacity
fin >> people
I'm using an ifstream
to get the file, I check to make sure that there is a file and then I use while(!fin.eof())
to loop the entire txt file. Any help would be greatly appreciated. Thanks in advance!