#include<stdio.h>
#include<string.h>
#define size 21
#define max 5
int id[max][size];
char ln[max];
int pr[max];
int mt[max];
int fg[max];
void getrecord()
{
int i;
for(i=0;i<=4;i++)
{
clrscr();
printf("id number:");
scanf("%d",id[i]);
printf("last name:");
scanf("%s",ln[i]);
printf("prelim:");
scanf("%d",pr[i]);
printf("midterm:");
scanf("%d",mt[i]);
fg[i]=(pr[i]*0.4)+(mt[i]*0.6);
}
getch();
}
void displayreverse()
{
int i,p;
clrscr();
printf(" idno. lstnme prelim midterm fgrde");
for(i=4;i<=0;i--);
{
p=0;p++;
gotoxy(5,9+p);
printf("%d",id[i]);
gotoxy(5,9+p);
printf("%s",ln[i]);
gotoxy(5,9+p);
printf("%d",pr[i]);
gotoxy(5,9+p);
printf("%d",mt[i]);
gotoxy(5,9+p);
printf("%d",fg[i]);
}
getch();
}
main()
{
getrecord();
displayreverse();
exit(0);
}
comp_sci11
0
Light Poster
Recommended Answers
Jump to PostPlease describe your problem a bit more. What are the errors that you are getting?
Jump to PostWhich compiler are you using???
Jump to PostHere are some problem with your code
1)
printf("last name:"); scanf("%s",ln[i]);
replace it like
printf("last name:"); scanf("%s",ln);
2) The same problem with other scanf also. Give address to scanf.
ex :scanf("%d",&(pr[i]));
Jump to PostTry changing this part in
displayreverse()
void displayreverse() { int i,p; printf(" idno. lstnme prelim midterm fgrde"); for(i=4;i>=0;i--); {
Please do not use
clrscr
, andgotoxy
. Those functions are not standard functions. Since you are obviously a student, try to learn …
Jump to Posti'm using a borland turbo C
That's your first big mistake! toss that crappy compiler into the bit bucket (delete it from your computer) and get a modern C compiler that you can use to learn the C and C++ languages correctly. You can't learn to drive a 2007 automobile …
All 19 Replies
comp_sci11
0
Light Poster
WolfPack
491
Posting Virtuoso
Team Colleague
dilip.mathews
3
Junior Poster in Training
comp_sci11
0
Light Poster
dilip.mathews
3
Junior Poster in Training
comp_sci11
0
Light Poster
comp_sci11
0
Light Poster
comp_sci11
0
Light Poster
WolfPack
491
Posting Virtuoso
Team Colleague
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
comp_sci11
0
Light Poster
WolfPack
491
Posting Virtuoso
Team Colleague
comp_sci11
0
Light Poster
WolfPack
491
Posting Virtuoso
Team Colleague
dilip.mathews
3
Junior Poster in Training
comp_sci11
0
Light Poster
comp_sci11
0
Light Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.