how do i keep track of the values entered so far so that i can get hte average in the display grade function? i.e. all scores entered so far...

#include <stdio.h>
#include <stdlib.h>

#define TRUE 1
#define FALSE 0
#define SENTINEL -1

int getGradeValue(int, int);
void displayGrade( int, char);
int makeLetterGrade(int*);
int sentinel_value_encounted(int *);
int main(void)
{
	char letter;	
        int value;  
while ( !sentinel_value_encounted(&value)){

//        printf("Enter a value, between 0 and 110, representing the\n");
//        printf("grade for the examination\n");
//        scanf("%d", &value);

	
	int value = getGradeValue(0,110);
	letter = makeLetterGrade(&value);
	displayGrade(value, letter);
        printf("Enter a value, between 0 and 110, representing the\n");
        printf("grade for the examination\n");
        scanf("%d", &value);
}

        printf("Enter a value, between 0 and 110, representing the\n");
        printf("grade for the examination\n");
        scanf("%d", &value);

	return EXIT_SUCCESS;
}
int getGradeValue(int mingrade, int maxgrade)
{

	int value;
//while ( !sentinel_value_encounted(&value)){

        printf("Enter a value, between 0 and 110, representing the\n");
        printf("grade for the examination\n");
        scanf("%d", &value);
if (0<= value <= 110)
	return (value);
else
{
        printf("Invalid grade\n");
}  
//        printf("Enter a value, between 0 and 110, representing the\n");
//        printf("grade for the examination\n");
//        scanf("%d", &value);

        return EXIT_SUCCESS;
}

int makeLetterGrade(int *value)
{ 
	int  a_max, a_min, b_max, b_min, c_max, c_min, f_max, f_min;
	char letter;
	char A;
	char B;
	char C;
	char F;
	char X;	
	
        printf("Enter max and min grade value for A\n");
        scanf("%d %d", &a_max, &a_min);

        printf("Enter max and min grade value for B\n");
        scanf("%d %d", &b_max, &b_min);

        printf("Enter max and min grade value for C\n");
        scanf("%d %d", &c_max, &c_min);

        printf("Enter max and min grade value for F\n");
        scanf("%d %d", &f_max, &f_min);

if (a_max>=*value&&*value>=a_min)
	letter = 'A';
else if (b_max>=*value&&*value>=b_min)
{
        letter = 'B';
}
else if (c_max>=*value&&*value>=c_min)
{
        letter = 'C';
}
else if (f_max>=*value&&*value>=f_min)
{
        letter = 'F';
}
else
{
        letter = 'X';
}
	return letter;
}
      
void displayGrade (int value, char letter)
{
        static int nscore = 0;
        int tscore;
	
        printf("The score of %d earned a grade of %c\n", value, letter);
        printf("%d score were entered so far.\n", ++nscore );
        printf("All scores entered so far total %d\n", tscore);
        printf("The average score is %d\n", tscore/nscore);
}   

int sentinel_value_encounted(int *value)
{
if  (*value != SENTINEL)
        return (FALSE);
else
        return (TRUE);
}

Arrays are good for that.

As would indenting your code, and deleting all the commented out code before you post it to a forum.

if you dont need to recall every individual grade, you can just add each grade for that person to a running total, and keep track of the number of entries.

then just divide the total by the number of entries for the average.

if you need to retain each grade for later use (display or further calculations) then arrays as salem ^ mentioned would probably be the bestest choice for you at this point.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.