hi, i have just come back to school after 18 years i dont know what
possessed me to think i could learn how to program. i am so
handicapped when it comes to technology. i have tried to figure out
how to post my problem on your message board but i cant figure it out.
(i think maybe i just did)
here is my program it will not "compile" yyyyyyyyyyyyy????????
what was i thinking please end my miseryCode:#include <stdio.h> #define students 3 #define exams 4 /* function prototypes */ void minimum( const int[][ exams ], int, int ); void maximum( const int[][ exams ], int, int ); void average( const int[][ exams ], int, int ); void printArray( const int[][ exams ], int, int ); int main() { const int studentGrades[ students ][ exams ] = { { 77, 68, 86, 73 }, { 96, 87, 89, 78 }, { 70, 90, 86, 81 } }; void (*f[4])(int [][ exams ], int, int) = {printArray,minimum,maximum,average}; int choice; printf( "Enter a choice:\n"); printf( "0 Print the array of grades\n"); printf( "1 Find the minimum grade\n"); printf( "2 Find the maximum grade\n"); printf( "3 Print the average on all test for each student\n"); printf( "4 End Program\n"); scanf( "%d", choice); while( choice >= 0 && choice < 4 ){ (*f[choice])(studentGrades,students, exams); printf( "Enter a number between 0 and 3, 4 to end: "); scanf( "%d", &choice); } printf( "Program execution completed."); return 0; } void printArray( const int studentGrades[students][ exams ], int students, int exams ) { int i; int j; printf( " [0] [1] [2] [3]" ); for ( i = 0; i < students; i++ ) { printf( "\nstudentGrades[%d] ", i ); for ( j = 0; j < exams; j++ ) { printf( "%-5d", studentGrades[ i ][ j ] ); } } } /* Find the minimum grade */ void minimum( const int studentGrades[students][ exams ], int students, int exams ) { int i; int j; int lowGrade = 100; for ( i = 0; i < students; i++ ) { for ( j = 0; j < exams; j++ ) { if ( studentGrades[ i ][ j ] < lowGrade ) { lowGrade = studentGrades[ i ][ j ]; printf( "Lowest Grade is %d",lowGrade); } } } } /* Find the maximum grade */ void maximum( const int studentGrades[students][ exams ], int students, int exams ) { int i; int j; int highGrade = 0; for ( i = 0; i < students; i++ ) { for ( j = 0; j < exams; j++ ) { if ( studentGrades[ i ][ j ] > highGrade ) { highGrade = studentGrades[ i ][ j ]; printf( "Highest Grade is %d", highGrade); } } } } /* Determine the average grade for a particular student */ void average( const int studentGrades[students][exams], int students, int exams) { int i; while(i < students){ int sum = 0; double avg = 0.00; for ( j = 0; j < exams; j++ ) sum += studentsGrades[ i ][ j ]; avg = static_cast<double>(sum)/exams; printf( "The average grade for student %d is %.2f", i, avg); i++; } }



LinkBack URL
About LinkBacks





) in his post, but without code tags so the formatting was lost. I just put the tags around it. 
