Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Read student data in the form Jane Lee 1 0 0 9 8 9 7 1 0 0 Aaron X . Schmidt 3 7 4

Read student data in the form
Jane Lee
1009897100
Aaron X. Schmidt
37424954
Frank von Tardy
23107
...
Use getline to read the name of the student. Then read the next line and convert it to an input string stream. Read the numbers from the input stream, adding them to the total.
Print the name and total score for each student.
students.cpp
#include
#include
#include
using namespace std;
int main()
{
cout << "Input file: "<< endl;
string input_file_name;
cin >> input_file_name;
/* Your code goes here */
string student;
while (getline(in, student))
{
/* Your code goes here */
cout << student <<": "<< total << endl;
}
return 0;
}
scores1.txt
Joe Smith
87897510
Mary Jane Chu
97897510
Alberto X. Gonzales
878971010
scores2.txt
Mary Jane Chu
97897510
Jane Prey
108897510
Alberto X. Gonzales
878971010
Frank von Tardy
Joe Smith
86897510

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

? SQ 1 0

Answered: 1 week ago