![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2007
Posts: 1
Rep Power: 0
![]() |
2d array
#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()
{
char scoretograde(int score);
int test_score[row_size][column_size];
int rows,columns;
char grade;
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\tuniversity 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\tAACS1084\tAACS1123\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");
printf("\n\n\n\n");
printf("\t\t\tRESULT ANALSIS REPORT\n");
printf("\t\t\t---------------------\n");
printf("\n");
}Last edited by DaWei; Nov 26th, 2007 at 7:40 AM. Reason: Added code tags. |
|
|
|
|
|
#2 |
|
Professional Programmer
|
Re: 2d array
Use code tags
![]()
__________________
JG-Webdesign |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: 2d array
Are you asking a silent question? Showing off your code? Demonstrating your inability to post your code in tags? Pray, enlighten us.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() ![]() |
Re: 2d array
Invisible fonts again, man I wish we could turn those off in the preferences.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem processing file into a char array | csrocker101 | C++ | 1 | May 8th, 2007 11:50 PM |
| Need help setting up this array | programj | Java | 12 | Apr 23rd, 2006 9:04 PM |
| changing size of an array | Eric the Red | Java | 3 | Apr 3rd, 2006 8:19 PM |
| Installing IPB 2.03 | bh4575 | Other Web Development Languages | 0 | Apr 23rd, 2005 2:36 AM |
| Converting 1-dimensional array to 2-dimensional array | Tazz_Mission_13 | Java | 6 | Apr 8th, 2005 11:58 AM |