Aright, i am now at a 3rd method.
Its where i now retrieve certain parts of a text file, the method is called "outputresult"
It's goal is to retrieve each of the grades from a text file i got.
So far, i computed the grade in teh findGrade method and want to retrieve it for outputresult.
Here's more of my source code, with findGrade but now finished:
Code:
void findGrade(int answer[][TOTAL_QUESTIONS], int count, double grade[], int miss[][TOTAL_QUESTIONS])
{
int i;
int j;
count=0;
double total=0.00;
for (i=0; i<=count; i++)
{
for (j=0; j<=TOTAL_QUESTIONS; j++)
{
if (answer[i][j] == answer[0][j])
{
miss[i][j] = 1;
total = total + 1;
}
else
miss[i][j] = 0;
}
grade[i] = (double)total/TOTAL_QUESTIONS * 100;
total = 0;
}
}
double findAvg(double grade[],int count)
{
int i=0;
int j=0;
double total = 0.00;
count = MAX_STUDENTS;
for(i=1;i < count;i++)
{
total = total + grade[i];
}
return (double)total/(count-1);
}
void printHeading(void)
{
printf("Student \t Grade Answer\tWrong Questions\n");
//printf("Question\tKey\tCorrect perc. Students\tNumber of Responses\n");
//printf("After Sort:\n");
//printf("Grade\tFrequency:\n");
}
void outputResult(int answer[][TOTAL_QUESTIONS], int count, double grade[], int miss[][TOTAL_QUESTIONS])
{
int i = 0;
int j = 0;
char c;
// printf("before loop");
for(i=1;i<TOTAL_QUESTIONS;i++)
{
findGrade(answer, count, grade, miss);
printf("%f\n", grade[i]);
}
// printf("%f",grade);
}
When i run it...it just gives me:
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
instead of for example:
38.24
33.11
76.55
44.33
22.89
102.45
etc.
Help would be appreciated!