Answered step by step
Verified Expert Solution
Question
1 Approved Answer
//--> that is where you need to add code. Please complete the code #include #include using namespace std; //--> write the prototype for the function
//--> that is where you need to add code. Please complete the code
#include#include using namespace std; //--> write the prototype for the function printStudentDetails //--> int main(){ const int NUM_STUDENTS= 2; // define a string array of size NUM_STUDENTS //--> // define 2 double arrays and of size NUM_STUDENTS //--> // repeat the for loop until for(int i=0; i< NUM_STUDENTS; i++) { cout << "Enter Student "<< (i+1) << " Details" << endl; cout << "Enter Name: "; cin.ignore(); // Take the student name as input using getline function and put that name into the current element of array //--> cout << "Enter Subject 1 Mark: "; // Take the subject 1 marks as input into the current element of array //--> cout << "Enter Subject 2 Mark: "; // Take the input for subject 2 marks as above //--> } // Define a double array named of size NUM_STUDENTS //--> // Iterate until NUM_STUDENTS //-->for(???;???;???) { // calculate current element of by finding the average of current elements of arrays // and //--> } // Call the printStudentDetails function //--> const int NUM_ROWS= 2; const int NUM_COLS= 2; int matrix1[NUM_ROWS][NUM_COLS]; // Define a 2 dimensional array as above //--> cout << "Enter Matrix 1: "; for(int row=0; row < NUM_ROWS; row++){ cout << "Enter Row " << (row+1) << endl; for(int col=0; col < NUM_COLS; col++){ cin >> matrix1[row][col]; } } // Take the input for matrix 2 as above //--> // Define a 2 dimensional integer array with NUM_ROWS and NUM_COLS as its sizes //--> // Iterate over the rows of the matrix for(???; ???; ???){ // Iterate over the columns of the matrix for(???;???;???){ // caculate the current element of as a sum of current elements of arrays and < matrix2> //--> } } cout << "Matrix 1 = "<< endl; for(int row=0; row < NUM_ROWS; row++){ for(int col=0; col < NUM_COLS; col++){ cout << matrix1[row][col] << " "; } cout << endl; } cout << "Matrix 2 = " << endl; //--> Print as above cout << "Matrix 1 + Matrix 2 = "<< endl; //--> Print as above } void printStudentDetails(string names[], double marks[], int numOfStudents) { cout << "Student Name \t Average Marks" << endl; // Iterate until numOfStudents and print each name and corresponding marks //-->for(???;???;???) //--> cout << ???;
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