Design, then write a computer C++ program to output testscores for a class. The
ID: 3615535 • Letter: D
Question
Design, then write a computer C++ program to output testscores for a class. The design must include the algorith formain and for each of the functions you define; forthe function you define, also identify the function parameters andwhether they are passed by value or by reference. input: The first 10 floating point values ina data file h:test4.txt are the correct answers to a math test.Next the file contains data for each of the students in the classwho took the test: the student ID followed by student's 10 answers.The number of students is not specified, since the sample datacould be 20.3 41.7 9.5 -3.0 78.0 -78.22 -5.0 4.8 68.1 14.3 HU123 20.3 12.2 -8.0 -3.0 75.2 -78.2 -3.0 4.8 68.1 14.3 SM456 19.0 42.7 9.5 -3.0 70.0 -78.2 -5.0 4.8 68.1 14.3 Processing: Do not use global variables. Input and output usefiles, which are opened in main. Two functions arerequired; more may be used. The function readValues is to read 10input values from an input file and store them in an array. Inmain, a call to readValues is used to obtain ananswer key array; later a call to readValues isused to obtain an array of students answers. Define a function computerScore, which hasboth the answer key array and a student answer array as parameters;it computes the number correct (0 to 10) and makes this valueavailable in main. Output: Each line of the output file containsa student ID and the student's score. For example Student Score HU123 6 SM456 8 Design, then write a computer C++ program to output testscores for a class. The design must include the algorith formain and for each of the functions you define; forthe function you define, also identify the function parameters andwhether they are passed by value or by reference. input: The first 10 floating point values ina data file h:test4.txt are the correct answers to a math test.Next the file contains data for each of the students in the classwho took the test: the student ID followed by student's 10 answers.The number of students is not specified, since the sample datacould be 20.3 41.7 9.5 -3.0 78.0 -78.22 -5.0 4.8 68.1 14.3 HU123 20.3 12.2 -8.0 -3.0 75.2 -78.2 -3.0 4.8 68.1 14.3 SM456 19.0 42.7 9.5 -3.0 70.0 -78.2 -5.0 4.8 68.1 14.3 Processing: Do not use global variables. Input and output usefiles, which are opened in main. Two functions arerequired; more may be used. The function readValues is to read 10input values from an input file and store them in an array. Inmain, a call to readValues is used to obtain ananswer key array; later a call to readValues isused to obtain an array of students answers. Define a function computerScore, which hasboth the answer key array and a student answer array as parameters;it computes the number correct (0 to 10) and makes this valueavailable in main. Output: Each line of the output file containsa student ID and the student's score. For example Student Score HU123 6 SM456 8 Output: Each line of the output file containsa student ID and the student's score. For example Student Score HU123 6 SM456 8Explanation / Answer
please rate - thanks #include #include using namespace std; void readValues(ifstream&,double[],int); int computerScore(double[],double[],int); int main() {int i,correct; double answers[10],input[10]; string id; ifstream in; ofstream out; in.open("test4.txt"); //open file if(in.fail()) //is it ok? { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.