I'm working on my homework for my online introductory programming class and honestly I got a little behind so I'm struggling trying to figure out all the machine problems, especially since the textbook isn't very helpful. I'm trying to figure out how to get my program to read the data file and then store them into the variables I've declared.
This is the part of the problem that I'm currently struggling with: "The data file is arranged with the information for each applicant on a separate line. Your program must process the data until the end of file is reached, at which time the program must print out the total number of applicants and the number of acceptances to each school. The data file should be created by you. Create the file and store it in the same project folder as your program."
The input file looks something like this:
L 4.0 600 650 N
M 3.9 610 520 N
L 3.8 590 600 N
L 3.0 600 600 Y
L 3.4 600 600 N
etc..
the variables from left to right are which school is being applied to, gpa, math SAT, verbal SAT and if parents are alumnus.
Here's what I've got so far which I'm sure is all wrong.
if (inFile.is_open ())
{
while (inFile >> school >> gpa >> mathSAT >> verbalSAT >> alumnus)
{
// only to check if we read it correctly.
cout << school << '\t' << gpa << '\t' << mathSAT << '\t';
cout << verbalSAT << '\t' << alumnus << '\n';
// use your input here
}
inFile.close (); // not needed - stream will close itself
}