array.....

Discussion in 'C' started by mancode1004, Nov 25, 2007.

  1. mancode1004

    mancode1004 New Member

    Joined:
    Nov 25, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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");
       
    	}
     
    Last edited by a moderator: Nov 25, 2007

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice