Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   array..... (http://www.go4expert.com/forums/array-t7531/)

mancode1004 25Nov2007 19:36

array.....
 
i want to write a rogram to display the student gpa first enter the score show the average of the gpa,highest and lowest
the display total the number of grade in 2 dimensional array
i stuck in the middle don't know how to calculate the gpa realy stuck in thia part
this is my program
Code:

#include<stdio.h>
#include<stdlib.h>
#define column_size 30
#define row_size 50

void input_table(int *rows,int *column,int arr[][column_size]);
void output_table(int rows,int columns,const int arr[][column_size]);

int main()
{

        int test_score[row_size][column_size];
        int rows,columns,score;
       
        input_table(&rows,&columns,test_score);
        output_table(rows,columns,test_score);

        return 0;
}
void input_table(int *no_of_rows,int *no_of_columns,int arr[][column_size])
{
        int i,j;
                printf("\n");
        printf("\t\t\UNIVERSITY OF SUNDERLAND\n");
        printf("\t\t\t------------------------\n");
        printf("\n");
          printf("Enter number of rows    : ");
        scanf("%d",&(*no_of_rows));
        printf("Enter number of columns : ");
        scanf("%d",&(*no_of_columns));

        for(i=1;i<=*no_of_rows;i++)
                for(j=1;j<=*no_of_columns;j++)
                {
                        printf("Enter value of test score [%d][%d] :",i,j);
                    scanf("%d",&arr[i][j]);
               
                }
}
void output_table(int rows,int columns,const int arr[][column_size])
{   
        int i,j;
       
                system("cls");
        printf("\n");
        printf("\t\t\tEXAMINATION PERFORMANCE REPORT\n");
        printf("\t\t\t------------------------------\n");
        printf("\n");
                printf("Student No\tAACS1089\tAACS1283\tGrade Point Average\n");
        printf("-------------\t--------\t--------\t-------------------\n");

        for(i=1;i<=rows;i++){
                printf("\t\n%3d",i);
        for(j=1;j<=columns;j++)
                printf("\t\t%3d",arr[i][j]);
        }
       
        printf("\n\n");
        printf("AVERAGE GPA = %d\n ");
        printf("\n");
        printf("HIGHEST GPA =  %d    obtained by student No.=\n");
        printf("LOWEST  GPA =  %d    obtained by student No.=\n");
 
        }



All times are GMT +5.5. The time now is 12:45.