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

1) create a data file of the following structure (each represents the test score

ID: 3622077 • Letter: 1

Question

1) create a data file of the following structure (each represents the test scores of a class):
the first two numbers are the number of students and the number of tests (integers), respectively.
Then each row represents the test scores of a student. Each student's scores is in different row (it
does not really matter if they are in different row or not, in fact.)
3 6
3.9 4.5 2.1 1.0 2.4 4.3
3.1 4.2 5.1 6.2 1.0 2.7
1.2 2.3 3.1 4.2 5.2 6.4


2) create a porgram that asks for an input file that has the structure
described in 1).
a)Read the data onto a multidimensional dynamic array of
floats (by means of pointer and new). And print:
b) the average (mean) test score for each student (you could label the student by 1, 2, 3, etc.)
c) Then delete the pointer arrays by using delete function properly.

Explanation / Answer

#include #include using namespace std; int main() { // input file stream object // opens infile.txt file for input ifstream inFile("infile.txt"); //checking file existence if(inFile.fail()) { cout row >> col; // two dimensional dynamic float type array float **arr = new float *[row]; // one dimension array to calculate avearge float *avg = new float[row]; //reads data from the input file infile.txt for(int i = 0 ;i arr[i][j]; avg[i] += arr[i][j]; } //calculating average avg[i] = avg[i]/col; } //displaying average of each student for(int i = 0; i