/* readfile.cpp Read Student scores from scores,txt file and print out the data on screen The input file, which is called "scores.txt" contains the following: John 99 80 77 50 Robert 100 20 50 99 Running the program looks like: The input file contains: Name: John Score1:80 Score2:77 Score3:50 Score4:50 Name: Robert Score1:100 Score2:20 Score3:50 Score4:99 */ #include #include // For the letter checking functions #include // For file input and output #include using namespace std; int main() { ifstream inStream; // declare an input file stream char name[14]; // Temp String to save the name int score1,score2,score3,score4 = 0; // Temp Int for saving Scores char c; // input character int i; // loop counter // open input file inStream.open("scores.txt"); // associate the actual file name with "inStream" if ( inStream.fail() ) { cout << "Input file opening failed. Exiting...\n\n"; exit(-1); } // Process input file one character at at time, Saving Names and scores. // Note that the input skips leading spaces, which is why we don't see // them as part of the output. cout << "The input file contains: \n"; while ( !inStream.eof() ) { inStream >> name ; inStream >> score1; inStream >> score2; inStream >> score3; inStream >> score4; // Printing the data on screen cout<