C newb really could use your help!
Code:
Hello all:
I am new to C programming and would really appreciate some good advice on the code I have written on how to get it to work right and would be very great full. I'm getting numerous compiler errors when I remove the remark. If you can help, please do! And point me in the right direction. Thanks!
/*
#include <stdio.h>
#include "constants.h"
extern void bubbleSort(int[][],int);
extern void generateHistogram(int[][], int);
int median (int grades[][], int number);
double averageStudent(int setOfGrades[][]);
double averageExam(int setOfGrades[][]);
double averageofAverage(int averagesofstudents[]);
int main()
{
int classAverage;
int median[EXAMSCORES];
int score[NUMBERofSTUDENTS][EXAMSCORES];
int i;
int j;
int studentaverage;
int studentTotal = 0;
int examtotal = 0;
//double studentaverage[NUMBERofSTUDENTS];
double examaverage[EXAMSCORES];
double averagesAverage;
for (i=0; i<NUMBERofSTUDENTS; i++)
{
for (j = 0; j < EXAMSCORES; j++)
{
scanf("%d", score[i][j]);
}
}
for (i=0; i<EXAMSCORES; i++)
{
for (j = 0; j < NUMBERofSTUDENTS; j++)
{
printf("%d", score[i][j]);
}
}
for (i=0;i<NUMBERofSTUDENTS;i++)
{
for(j=0; i<EXAMSCORES; j++)
{
studentTotal = studentTotal+(score[i][j]);
}
studentaverage= studentTotal/4;
printf("Average for student %d", i);
printf("is %.2f", studentaverage);
studentTotal = 0;
}
for (j=0;j<EXAMSCORES;j++)
{
for (i=0;i<NUMBERofSTUDENTS;i++)
{
examtotal = examtotal + score[i][j];
}
printf("Average for exam %d", j+1);
printf("is %.2f", examtotal/NUMBERofSTUDENTS);
examtotal = 0;
}
// averagesAverage = averageofAverage (studentaverage[i]);
printf("The average of the students averages is %.2f\n", averagesAverage);
return 0; /* end main */
}
/*
double averageStudent(int setOfGrades[num][exam])
{
int i;
int j;
int total=0;
double avg;
int num;
int exam;
for (j=0; j<exam; j++)
{
total = total + setOfGrades[i][j];
}
avg = total/exam;
return avg;
}
*/
/*
double averageExam (int setOfGrades[num][exam])
{
int i;
int j;
int total=0;
double avgExam;
int num;
int exam;
for (i=0; i<num; i++)
{
total=total + setOfGrades[i][j];
}
avgExam = total/num;
return avgExam;
}
*/
/*
double averageofAverage (int averagesofstudents[num])
{
int i;
int total=0;
double avgAvg;
int num;
for (i=0; i<num; i++)
{
total=total + averageofstudents[i];
}
avgAvg = total/num;
return avgAvg;
*/