Question: Modify the grade book program to use a custom struct to hold the student's ID number and the percentage score for each item in the
Modify the grade book program to use a custom struct to hold the student's ID number and the percentage score for each item in the grade book. The program should accept the entry of ID numbers and percentage grades (0100) until the user signals that he or she is done entering grades. The program should then print out the ID numbers and grades entered by the user, sorted by ID number. Again, be sure to format the code properly and provide comments in the C code.
#include
int main() { char choice; int percentArray[50]; int percentage; int count=0,i;
for(count=0; count<50; count++) { //for loop to read the grades till array size printf("-------------------Enter percentage--------------- Add marks(a) Quit(q) "); scanf("%c",&choice); if(choice == 'a') { //if user choice is a, then read the grade printf( "Enter grade:"); scanf("%d", &percentage); percentArray[count] = percentage; //add the grade to array } if(choice == 'q') //if the user choice is q, then exit the loop { break; } } printf("Grades are: "); for(i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
