00:01
In this question, we have to write a code in c.
00:04
So we have to modify the simple gradebook version 2.
00:10
Custom functions are introduced to encapsulate specific tasks for that.
00:16
So let us look at the explanation of some functions.
00:25
So first is add grade.
00:27
So this function will prompt the user to enter a grade and add it up to the array of grades that is there.
00:38
So it will also update the size variable to keep track of the number of grades that are there.
00:45
Second, we are using is print grade function.
00:52
So as you can see this prints all the grades entered by the user and stored in the array along with the space for each grade.
01:01
Then next we are using is calculate average.
01:12
So this function calculates and returns the average grade.
01:16
It's like basically then we have to use find highest grade function.
01:30
So this grade finds and returns the highest grade among the grade stored in the array.
01:36
And then similarly we have to use find lowest grade.
01:44
So this function finds and returns the lowest grade among the grades that are stored in the array.
01:53
So the main function utilizes these custom functions to interact with the user and store the grades and perform the required operations that are there.
02:02
So let us look at the code which we will see in a basic c compiler.
02:10
So first of all, we will utilize the we will use the header file that is there.
02:20
So this header file helps in the input output operations that are there.
02:25
So first of all, we will use the add grade option function.
02:33
So this function as you can see prompts the user to enter a grade and add set to the array that is arr.
02:41
So it takes two parameters that is arr that is the array of the grades and the size as you can see here a pointer to the size of the array.
02:50
So inside this function now it reads the grade input using scan f and checks if it is not equal to minus 1.
02:58
So if the grade is not minus 1 then it adds the grade to the array at the current size index and increments the size pointer by 1 as you can see here.
03:09
So after this function, we will be using the print grade function.
03:16
So we will basically write the print grades function in the same way as we wrote for the add grade.
03:22
So this function will print all the grades stored in the array that is arr.
03:27
So then it takes two parameters that is arr that is the array of grades and the size that is size of the array.
03:34
So it uses the for loop now as you can see it will also give just a basic the grades are output using the print f function.
03:43
Then we start a for loop.
03:45
So this for loop iterates over the array and print each grade followed by a space.
03:51
So that is why we have given this and it will print the each array that is followed by a space.
03:58
So for that we're using this so it will be then print a next line...