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

c++ program Please complete the exercises below. e) Implement a function named g

ID: 3813618 • Letter: C

Question

c++ program Please complete the exercises below.

e) Implement a function named getScores that takes an int array, its length, and an int parameter scores_entered. The function repeatedly asks the user to enter scores until the user enters -1 or the array capacity has been reached. The function stores the scores entered in the array and sets the scores_entered parameter to the number of scores entered by the user. The function returns nothing.

f) Implement a function named scoreStatistics that gets up to 100 scores from the user and prints the min, the max and the average score. The function takes no parameters and returns nothing. It does all its work by relying on the functions in 3, 4, and 5 implemented above.

g) Write a simple program that creates a multiplication table (10x10 two dimensional array). Once the table has been populated with values write two loops that print the values along the two diagonals of the the multiplication table.

Explanation / Answer

void getScores(int arr[], int length, int scores_entered)
{
int x;
cout <<"Enter numbers or -1 to stop ";
for(int i=0; i<length;i++)
{
cin >> x;
if(x ==-1)
   break;
else
{
   arr[scores_entered]=x;
   scores_entered++;
}
}
}
void scoreStatistics()
{
int min=0; int max=0;
float sum=0; int n;


cout <<"Enter 100 numbers ";
for(int i=0;i<100;i++)
{
cin >> n;
if(i==0) min=n;
if(n < min)
   min =n;
if(n > max)
   max = n;
sum+=n;
}

cout << "min is "<<min<<" Max is "<<max <<" and average is "<<sum/100;
}

int main()
{


int table[10][10];

for(int i=0;i<10;i++)
for(int j=0;j<10;j++)
   table[i][j]=j;
cout <<" Diagonal 1 ";
for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
{
   if(i==j)cout << table[i][j]<< " ";

}

}
cout <<" Diagonal 2 ";
for(int i=0;i<10;i++)
{
for(int j=9;j>=0;j--)
{

   if(j==9-i) cout <<table[i][j]<<" ";
}

}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote