Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CHALLENGE ACTIVITY 8.19.4: Rearrange the lines to compute the total score for a single student. 541708.3480878.qx3zqy7 Consider a comma-separated file that contains student names
CHALLENGE ACTIVITY 8.19.4: Rearrange the lines to compute the total score for a single student. 541708.3480878.qx3zqy7 Consider a comma-separated file that contains student names and scores such as the following: Jane Lee, 100, 98, 97, 100 Aaron X. Schmidt, 37, 42, 49, 54 Frank von Tardy, 2, 3, 10, 7 Full screen We can read the file one line at a time and use an istringstream object to process the scores. To get the position of the first comma, simply read words from the input stream until the word ends with a comma. Then, read and sum the numbers remaining on the line. Use get to remove the commas following each number. Rearrange the lines below to compute the total score for a single student. Assume that each student has at least one score. char ch; in.get(ch); total = total score; istringstream in;
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