Whitewater High School has contracted you to write a program that will read a fi
ID: 3626325 • Letter: W
Question
Whitewater High School has contracted you to write a program that will read a file of student names and test scores in the formation FIRST NAME LAST NAME: SCORE1 SCORE2 SCORE3, where each of the scores is an integer. Then your program is to print a report, sorted by last name with each of the last names fully capitalized (that is, if you read in Smith you print SMITH) followed by a comma, then the first name, then a colon, then the scores, then the average for the student, and lastly a letter grade (based upon 90 percent or greater being an "A," 80 percent or greater being a "B," and so forth). At the end of the report the averages for each test are to be printed also. Needless to say, the report must be written to a file and must be "pretty" (in proper columns and such). (HINT: Read in the whole line as a string, switch the first and last name, sort the names, then compute the math)
Also: At the bottom of each column of tests and the class average column, print the highest, lowest, and average test score. Additionally, at the end of the report print out the name(s) of the people who received A's, then those that received B's, then those that received C's, and so forth with proper headings and in alphabetical order.
Data file: data.txt
The data file content is (3 test scores of a total of 25 students):
Explanation / Answer
hi there this is what i did so far i have 4 exams next week so u can make the rest of the program there is every thing in here just u wil need to repeat what the program do to print the highest score and the lowest it is an easy thing to do by your self i hope that u will kepp what u said and rate life saver or helpful at least :) #include #include #include #include using namespace std; ifstream myfile; int GetIntVal(string strConvert) { int intReturn; intReturn = atoi(strConvert.c_str()); return(intReturn); } string IntToString(int intValue) { char *myBuff; string strRetVal; // Create a new char array myBuff = new char[100]; // Set it to empty memset(myBuff,'',100); // Convert to string itoa(intValue,myBuff,10); // Copy the buffer into the string object strRetVal = myBuff; // Delete the buffer delete[] myBuff; return(strRetVal); } string toup(string sentence) { for (unsigned int i = 0; i ='a') && (sentence[i]=90) return 'A'; else if(num>=80) return 'B'; else if(num>=70) return 'C'; else if(num>=60) return 'D'; else return 'F'; } void print(string ); void print_tofile(string ); int main() { string filename; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.