Question: Using C++ just need problem 3 Problem 2. Dynamic Array 1-D (15 points) A teacher needs a program to grade her students. She wants to
Using C++ just need problem 3
Problem 2. Dynamic Array 1-D (15 points) A teacher needs a program to grade her students. She wants to make the program flexible so she can use it every year, so the number of students is not fixed. The program should ask the teacher for the number of student and then using DYNAMIC MEMORY ALLOCATION, create the dynamic array for the grade of the students. The program then needs to ask the teacher the integer grade for each student in the range of 1 to 100, and store it in a dynamic array. After reading completely, pass your dynamic array to a programmer defined function that returns the average grade across the class. Display the average grade of the class.
Problem 3. Dynamic Arrays 2-D (20 points) Refer to what you did in Problem 2. Now the requirement of the teacher has changed. Still the number of students is not known in advance while writing the program, but now she gives 5 exams in a semester. But not all students take all 5 examssome take all 5, some take 4 and some may even take 1. For simplicity, you can assume no one takes 0 exams. Now, the program needs to compute the average grade for each student across all exams the student has taken. Compute the average by dividing the total score by 5, not how many exams the student has taken. Display the average for each student in a separate loop. HINT: You need a 2-D array and hence a double-referenced pointer. Think how you need to allocate memory to that pointer. Refer to Chapter 9 Slide 49. For each row, you need to allocate memory as per the number of tests a student has taken. This is different from the example in Slide 49, where the number of columns was fixed for each row. You will have to ask the user for the number of columns here. Youll need to create another array using dynamic memory allocation to store the average for each student.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
