Discover answers to your most pressing questions at Westonci.ca, the ultimate Q&A platform that connects you with expert solutions. Join our Q&A platform and get accurate answers to all your questions from professionals across multiple disciplines. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

c++ program Declare a 2-D array quiz marks which contains 10 rows and 5 columns. Each row corresponds to a particular student and each column corresponds to a particular quiz mark. Your program should read the input from the user and perform the following tasks: (1)Print the output as follows; Student 1: 80 90 70 100 60 Student 2: 98 85 100 99 89 (2) In a 1-D array store the average of quiz marks of each student. (3) In another 1-D array store the average of marks of each quiz.

Sagot :

The program illustrates the use of arrays and loops.

Arrays

Arrays are data types that hold multiple values in a variable, while loops are used to perform repetitive operations

The C++ program

The program in C++, where comments are used to explain each line is as followed:

#include <iostream>

using namespace std;

int main(){

   //This declares a 2D array of 10 rows and 5 columns

   int scores [10][5];

   //The following iteration gets input into the 2D  array

   for(int i = 0; i < 10;i++){

       for(int j = 0; j <5; j++){

           cin>>scores[i][j];

       }

   }

   //This declares an array for the average score by each student

   int average [10];

   //This initializes a counter k to 0

   int k = 0;

   //This iterates through the scores of each student

   for(int i = 0; i < 10;i++){

       //This prints an output header

       cout<<"Student "<<i+1<<": ";

       //This initializes the student score to 0

       int score =0;

       for(int j = 0; j <5; j++){

           //This prints the current score of the student

           cout<<scores[i][j]<<" ";

           //This calculates the total score

           score+=scores[i][j];

       }

       //This calculates the average score

       average[k] = score/10;

       k++;

       //This prints a new line

       cout<<'\n';

   }

   //This declares an array for the average score in each subject

   int marks [5];

   //This initializes a counter k to 0

   k = 0;

   //This iterates through the scores of each subject

   for(int i = 0; i < 5;i++){

       int score =0;

       for(int j = 0; j <10; j++){

           //This calculates the total score

           score+=scores[j][i];

       }

       //This calculates the average score

       marks[k] = score/10;

       k++;

   }

   return 0;

}

Read more about similar programs at:

https://brainly.com/question/14286128

Thank you for your visit. We are dedicated to helping you find the information you need, whenever you need it. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Westonci.ca is committed to providing accurate answers. Come back soon for more trustworthy information.