i dont know how you could display 20 values at the same time on the screen
do look at the output generated by my program
it's done using TurboC
Code:
#include <stdio.h>
#include<conio.h>
#define MAX_NUM_STUDENTS 20
#define TRAILER -9999
void input (float* , int* );
void display (float* , int* );
int main()
{
int student_num[20];
float grade[20];
clrscr();
input (&grade,&student_num);
display (&grade,&student_num);
getch();
return 0;
}
void input(float *grade, int *student_num)
{
int i;
for (i = 1;i != 20; i++)
{
printf ("Please enter up to %d students number.", MAX_NUM_STUDENTS);
scanf ("%d", &student_num[i-1]);
}
for (i = 1; i != 20; i++)
{
printf ("Please enter up to %d grades.", MAX_NUM_STUDENTS);
scanf ("%f", &grade[i-1]);
}
}
void display(float *grade,int *student_num)
{
int i;
for(i = 1; i != 20; i++)
{
printf ("\n Student #%d with Grades:%d",&student_num[i-1],&grade[i-1]);
printf ("\t Student #%d \t Grades%d \n",&student_num[i-1],&grade[i-1]);
printf ("\t_________\t_______\n");
}
}