Question
Part 1: Simple Grade Book, Version 1.1 Modify the grade book code from Unit 3 so that it uses heap memory to store percentage grades
Part 1: Simple Grade Book, Version 1.1 Modify the grade book code from Unit 3 so that it uses heap memory to store percentage grades in the range from 0 to 100 (inclusive). The program should allow the user to indicate when he or she is done entering grades (since the user may not have grades to fill the whole array). When the user is done entering grades, the program should print out the grades entered by the user. Be sure to free the heap memory before the program ends.
Part 2: Simple Grade Book, Version 2.0 Modify the grade book code from Unit 3 so that it uses 3 custom functions to calculate the average grade (arithmetic mean, not letter grade), report the highest grade, and find the lowest grade entered. This version of the program does not need to use heap memory, though you are welcome to do so. The program should allow the user to indicate when he or she is done entering grades (since the user may not have grades to fill the whole array). When the user is done entering grades, the program should print out the grades entered by the user. The program should also display the average grade, highest grade, and lowest grade.
#include
int main() { // initializing the array int grade[100],g; // initializing variables int i=0, m=0;
//This loop will restrict the size of the array to less than 100 for(i=0;i<100;i++)
// Asking the user to enter a value and telling them how to stop { printf("Enter Percentage Grade(0-100). Enter -1 to stop: "); scanf("%d", &g); //read grade input
//If statement that tells the program that if a user enter //-1 than the program will stop, since -1 can not be a "grade". if(g != -1) { // if the grade that is entered is not -1, then the grade will be saved and stored grade[m++]=g; //save to array } else break; //Used if grade is equal to -1. }
printf(" The Grades Are: ");
//Loop for "i" grades for(i=0; i return 0; }
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