Hello,
I am a college student taking a C course and my program isn't doing what it is supposed to do.
it isn't displaying (maybe not recording) values that it is supposed to.
I am supposed to take letter grades of ten students, turn them into numerical GPA using else/if function.
Any help please. Thank you - Robert
Not looking for anyone to do it for me... just advice. thanks.
Code:
#include<stdio.h>
#include<math.h>
double average(char z);
int main(void)
{
double g1;
double g2;
double g3;
double g4;
double g5;
double g6;
double g7;
double g8;
double g9;
double g10;
double AA;
double AB;
double AC;
double AD;
double AE;
double AF;
double AG;
double AH;
double AI;
double AJ;
double grade;
printf("Enter grade for students 1-10\n");
scanf("%c", &g1);
scanf("%c", &g2);
scanf("%c", &g3);
scanf("%c", &g4);
scanf("%c", &g5);
scanf("%c", &g6);
scanf("%c", &g7);
scanf("%c", &g8);
scanf("%c", &g9);
scanf("%c", &g10);
AA = (g1);
AB = (g2);
AC = (g3);
AD = (g4);
AE = (g5);
AF = (g6);
AG = (g7);
AH = (g8);
AI = (g9);
AJ = (g10);
return (0)
}
double average(char z)
{
char a, b, c, d, f;
double grade, final;
double AA, AB, AC, AD, AE, AF, AG, AH, AI, AJ;
if (z=='a')
{
grade = 4.0;
}
else if (z=='b')
grade = 3.0;
else if (z=='c')
grade = 2.0;
else if (z=='d')
grade = 1.0;
else if (z=='f')
grade = 0.0;
;
return(grade);
}