Hi all, need some suggestions. This code looks like a jumbled mess to me. I am missing something and am not sure what.
Now the question is that if we have exit function then why C11 standard introduced Exit? Actually exit function performs some cleaning before termination of the program like connection termination, buffer flushes etc. The Exit function in C/C gives normal termination of a program without performing any cleanup tasks. Atexit function. Use the atexit function to specify actions that execute prior to program termination. No global static objects initialized prior to the call to atexit are destroyed prior to execution of the exit-processing function. Return statement in main. Issuing a return statement from main is functionally equivalent to calling the exit.
-Main should determain the letter grade of an average based on a 10-point scale and print out this grade.
-GetGrades function should get number of grades, read the grades entered, find the sum of those grades and pass the sum and number to FindAverage.
-FindAverage will get the average of the grades and return the average to GetGrades.
-GetGrades will return this average to main.
Let's start with the function getGrades.
-GetGrades function should get number of grades, read the grades entered, find the sum of those grades and pass the sum and number to FindAverage.
The code you have for that function does this:
Gets the number of grades.
Uses the right shift operator in the while condition, which makes no sense.
Fetches a single grade.
Tries to find the average of that single grade, which makes no sense.
Just do what the requirement says:
Just code what the requirements say, one line at a time.