Question: Can someone please help me answer the following C++ question step by step with an explanation given the code I provided? If you help clearly

 Can someone please help me answer the following C++ question stepby step with an explanation given the code I provided? If youhelp clearly I will give you a good rating :) Task The

Can someone please help me answer the following C++ question step by step with an explanation given the code I provided? If you help clearly I will give you a good rating :)

Task The purpose of this program is a write a program that reads in score records from standard input and outputs such to standard output as follows: each score record is composed of a first name, last name, and score each field and record is delimited by whitespace o i.e., in particular, first and last names cannot contain whitespace each score is an unsigned integer Your program is to read in as many score records as is possible, i.e., keep reading score records until an end-of-file or the stream fails, or goes bad. After each record is read in, write it out immediately to standard output as follows: each record output must be followed by a newline character, between each field written must be a single space, and, the fields must be written out in this order: first name, last name, score. The score record must be declared as follows: 1. 2. 3. 4. struct score { std::string first_name_; std::string last_name_; unsigned int score_ }; 5. 6. and you must write suitable IOStream operator overloads to read from std::cin and write to std::cout each score. To help you with this, see the p3.cxx program from the lecture (which is also linked to below) and model your code after the code in that program. (NOTE: These overloads are the ONLY functions you can access any of the members of score.) Remember to #include all needed #include files, etc. Your program must be a valid C++20 program and you are not allow to use any C-language methods to accomplish the same. Using GCC: g++ -std=c++20 - Wall - Wextra-Wold-style-cast - Werror a1-soln.cxx If there are no errors output, the executable file generated will be called a.out (unless you also gave the compiler a filename with the -o option. It is noted here that there is nothing in the code that requires it to be C++20 --this assignment could be written using C++98 (i.e., the first standard). Sample Program Input File Consider this input file a 1-input dat: 1. 0 = E 2. 3. 4. $ cat al-input.dat charlie brown 56 sally brown 63 lucy van_pelt 89 linus van_pelt 67 snoppy dog 100 woodstock bird 112 $ 5. 6. 7. 8. 1 #include #include N 3 4 using namespace std; 5 6 7 8 8 9 struct fancy { int i; string s; }; 10 11 12 13 14 std::istream& operator >>(std::istream& is, fancy& f) { is >> f.i; is >> f.s; return is; } 15 16 17 18 19 std:: ostream& operator (std::ostream& os, fancy const& f) { os f.i ' ' f.s; return os; } 20 21 22 23 24 25 26 27 28 29 30 31 32 int main() { fancy f; if (cin >> f) cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!