Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.Print out the persons and their scores from both files 2.Each output line is l

ID: 441907 • Letter: 1

Question

1.Print out the persons and their scores from both files 2.Each output line is last name, "," , first name and score 3.Lines appear in ascending order by last name, then first name This is what i have so far cant figure out how to display both of the files in ascending order output should look like this Astaire, Estelle 88 Astaire, Fred 79 Lamb, Elia 77 Lincoln, Abe 88 Saramago, Jose 95 Shelley, Mary 77 Zola, Emile 99 #include using namespace std; #include #include #include struct person { string first, last; int score; }; int main() { ifstream data1, data2; data1.open("data1.txt"); if(!data1) { cerr << "Error: data1 could not be opened" << endl; exit(1); } data2.open("data2.txt"); // opens the file if(!data2) // file couldn't be opened { cerr << "Error: data2 could not be opened" << endl; exit(2); } person rec1; data1 >> rec1.first >> rec1.last >> rec1.score; while (!data1.eof()) { cout << rec1.last << ", " << rec1.first << " " << rec1.score << endl; data1 >> rec1.first >> rec1.last >> rec1.score; } person rec2; data2 >> rec2.first >> rec2.last >> rec2.score; while (!data2.eof()) { cout << rec2.last << ", " << rec2.first << " " << rec2.score << endl; data2 >> rec2.first >> rec2.last >> rec2.score; } data1.close(); data2.close(); return 0; }

Explanation / Answer

#include #include using namespace std; bool isVowel(char character); string substr(string line); int main() { string line; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote