Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program as follows: Ask the user for a number of students and a number of exams. Create and call a function that reads

image text in transcribedimage text in transcribedimage text in transcribed
Write a program as follows: Ask the user for a number of students and a number of exams. Create and call a function that reads in the grades and places them into a double array as we did in class; one row per student and one column per exam. Create and call a function that calculates the exam averages for each student and place them in an additional column (the column could already be there waiting for this function}. This function should also cout/print all of the averages to the screen. Back in the main, cout the class average (1 number). You should picture the double array for n students and m exams to be something like: Exam 1 Exam 2 Exam m Average Student 1 Student 2 Student n As mentioned in class, in order to pass a double array into a function we need a static value in the second array dimension. To accomplish this, we should create a static second dimension using #define, that is larger than we will need but is also sufficient for our need, and utilize only the portion of the array that is necessary. So before the main we will say #define Z 100 Then we may use 2 as our column size in array creation and in array use in function definitions and prototypes throughout our program. 100 is far more exams then any class would have so it would be sufficient for any exam number chosen. Now in the main we need to ask the userfor n students and m exams and declare an array as, say int grades[n][Z];. Next we create a function that reads in the grades and places them into a double array as something like void gradefill(int array[Z],int rows, int columns}{}; and call it from the main as gradefill(grades,n,m}; Now with the extra columns which we are not using you can picture the double array for n students and m exams to be something like: 1 2 m m+1 100 Exam 1 Exam 2 Exam m Average Student 1 Student 2 Student n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions