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

OVERVIEW: Write a complete C++ program to do the following: The program will rea

ID: 3558934 • Letter: O

Question

OVERVIEW: Write a complete C++ program to do the following:

The program will read in a set of data (from a data file) into three arrays, representing three rounds of bowling scores. The program will neatly print (to an output file) the original data, then it will compute the average of each bowler's scores and print that information. The program will find how the elements of the array for each individual round compare to the elements of the array for the average of the three rounds.

   MAIN PROGRAM DETAILS:

1. NOTE: The data will be read from a data file (this will be discussed separately).

First, the main program will read in a parameter value n. Then main will call a function read3arrays (details below) to read n groups of data into three arrays which the main program will call round1, round2, and round3 (or some other names of your choice).

2.   (All output will be sent to an output file.)   The main program will call a function print1array, sending it round1 and n. Before the function prints, the main program will print a heading explaining what the function will be printing. The print1array function (details below) will print the first n elements of the round1 array.

The main program will also call the print1array function for arrays round2 and round3.

3. The main program will call a function makeavgarray, sending it the three rounds arrays and n; there will also be another parameter, a new array of integers called avgscores. The function will store values in the avgscores array (details below).

When the function returns control to the main program, the main program will use print1array one more time to print the values in the new avgscores array.

4. The main program will call a function comparetoavg, sending it two int arrays and their size n, plus three reference parameters. Using these three reference parameters, the function will find and "return" three things: how many elements in the first array are less than, equal to, or greater than the corresponding elements in the second array.

For example, assume that the first array holds 14    67   15   110    3    9, and the second array holds 20   25 30 110 2   5, with n=6. The function will store 2, 1, and 3 in the three reference parameters. (Why? The first array is less than the second one 2 times; they are equal 1 time; the first array is greater than the second one 3 times.)

The main program will call this function three times. The first time it will send round1 and avgscores; the second time it will send round2 and avgscores; the third time it will send round3 and avgscores. In each case, using the three actual parameters which match to the three reference parameters in the function, the main program will print the result of that call with messages, like this (print in main, not in the function):

   The first array has 7 values smaller than the average array

   The first array has 3 values equal to the average array

   The first array has 6 values greater than the average array

FUNCTION DETAILS:

   The function read3arrays will read a set of data into three arrays. The function will get four parameters, three arrays and an integer giving the size n of these arrays. Each line of data will contain three values (for example, 50 122 143). The first data value (50) will be read into the first array; the second data value (122) will be read into the second array, and similarly for the third data value (143). Then the function will read the second line of data containing three data values, and so on. Do this for each position in the array: 0,1,2,

Explanation / Answer

#include using namespace std; int main(int argc, char** argv) { int frame[10][3] = {{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0,0}}; int frameOutcome[10]; int frameTotal[10]; int currentFrame = 0; int totalScore = 0; do { cout