problem with 2d array program.
I'm having a problem with a 2d array program. I wrote the bulk of a program that takes the marks of three courses and provides an average. The output looks like this;
Prgm Eng. Math Average
0,0 0,1 0,2 0,3
1,0 1,1 1,2, 1,3
and so on for five rows.
The next part of the program that I'm having trouble with is finding the highest of the three marks and adding this data to the array. My messed up code for the function looks like this:
}
void print_marks(double marks[ROWS][COLS],double avg[ROWS],int r,int
c)
{
int i,j;
for (i=0;i<r;i=i+1) {
printf("%4s%8s%8s%8s%11s\n"," ", "Prgm", "Math", "Engl", "Avrg"$
for (j=0;j<c;j=j+1) {
printf("%8.1f", marks[i][j]);
}
printf("%11.1f\n", avg[i]);
}
}
This part returns the expected results.
The messedup find_high function:
}
void find_high(double marks[ROWS][COLS],int r,int c)
{
int i,j;
for (j=0;j<r;j=j+1) {
for (i=0;i<r;i=i+1) {
if (marks[i][j]>marks[i+1][j]) {
}
I'm confused about the code for this part. Any help would be appreciated.
Colin