Question
Consider a file that contains student grades such as the following: Jane Lee 100 Aaron X. Schmidt 37 Frank von Tardy 2 ... As with
Consider a file that contains student grades such as the following:
Jane Lee 100 Aaron X. Schmidt 37 Frank von Tardy 2 ...
As with the country names, the student names dont have a fixed number of words. To process the input, read one line of input at a time. Then, starting from the end of the line, keep moving toward the beginning until you no longer see digits. Then break the line up into a name and a grade. Remember to remove any spaces between the name and the grade. Assume in has already been initialized as an ifstream that reads the file.
Not all lines are useful.
Order the statements by moving them into the left window. Use the guidelines for proper indenting.
Order the statements by moving them into the left window. Use the guidelines for proper indenting. Done while (isdigit(line[i])) string grade = line.substr(i + 1); int j = i; while (in >> line) while (getline (in, line) string line; string name = line.substr(0, 1); string name = line.substr(0, j - 1); string name = line.substr(0, 3 + 1); process (name, grade); j-.; while (!isdigit(line[i])) int i = line. length() - 1; int i = 0; j++; while (j > 0 && isspace(line[j])) i++; i-; { { { } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started