I'm trying to read a file that then sorts three sets of data (states, miles, shelters) into three parallel arrays. I've compiled it, but I'm still getting some error messages. Greatly appreciate an extra pair of eyes or two on this!
when you put your prototypes at the top, don't declare the variables. What this will do is require you to pass an argument, causing compiler errors if you don't pass an arg. It's good practice.
You can eliminate in_stream and just use in as the alias of your stream.
Also, in.seekg(0, ifstream::end) jumps the pos to the end of the file. You might want to fix that. Opening the file starts it at the beginning. You can use ifstream::pos_type (which is a typename) and declare a variable to store the first pos in. You can then seek the end, and then use in.seekg(pos) to go back to the beginning (once you have calculated the bytes of the file by using both positions).
Line 73: using in.good() will return false if the file stream is bad, or the end of the file is reached, whereas .eof() returns true only if the end has been reached. If somthing should happen, and the file stream becomes corrupted, then it will create an infinite loop.
line 60: you can only open 1 stream at a time, for each file; it's also safer...
****************************
all-in-all: you should declare only 1 ifstream, and open/close it as you wish. Other than that, I highly recommend making your code easier to read by spacing the curly-braces properly.