Question
(Make the changes in this program so that arrays are transferred to the functions as pointer variable parameters and the items of the arrays are
(Make the changes in this program so that arrays are transferred to the functions as pointer variable parameters and the items of the arrays are accessed using pointer variables inside the functions.)
(See the sample program - Pr7-12 Modified with Functions using Pointers)
Write a program in C++ that will compute each students test score, class average and Student IDs those who score over 80.
The total number of questions (NUM_Q) in the test is 50 that is defined as a constant. There are 4 students in the class and (NUM_STUDENTS) is defined as a constant.
Use the following arrays:
id- correct - incorrect - score -
stores student id stores number of correct answers stores number of incorrect answers stores test score
- type string - type int - type int - type int
Use the following functions:
1. Function getData will get data - id and correct for each student and stored in two arrays id and correct.
getData (id, correct, NUM_STUSENTS); Sample Input screen
Students ID : Number of correct answers
:
Function calculate will find out the number of incorrect answers (NUM_Q correct answers) and score (2 * number of correct answers) and those data will be stored in incorrect and score array.
calculate (correct, incorrect, score, NUM_STUDENTS);
Function findAverage function will calculate the test average of all students. The variable average is defined as type double.
average = findAverage (score, NUM_STUDENTS);
Function findHigh will find out the highest test score and return the value to the calling program.
high = findHigh (id, score, NUM_STUDENTS);
Function display will display the table with id, number of correct answers, number of incorrect answers, and score. This function will also print the average test score, highest test score and a table with id and scores those are above 80. Test score average will be displayed with 2 digits after decimal point.
display (id, correct, incorrect, score, average, high, NUM_STUDENTS); Sample data:
ID
1234 3427 2020 3215
ID Correct Answers
Sample Output:
Correct Answers
40 47 35 41
Incorrect Answers Score
40 47 3 94 35 15 70 41 9 82
____ ____
Scores above 80
ID Score
3427 94
3215 82
1234 3427 2020 3215
Test Score Average: Highest Test Score:
10 80
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started