我写了一个程序,其中显示了关于5位学生的数据,我想知道如何显示学生姓名注册号并标记谁在数组中获得最高分数。 该方案是这样的:如何从数组中打印整行?
#include "stdio.h"
#include "conio.h"
struct student
{
char name[30];
char reg[10];
short int marks_dbms;
short int marks_prog;
};
void main()
{
short int i;
student a[5]={
{"salman","B-1499",92,98},
{"Haider","B-1489",34,87},
{"zeeshan","B-1897",87,90},
{"faizan","B-1237",56,66},
{"Asif","B-1233",88,83}
};
for(i=0; i<5; i++)
{
printf("%s\t",a[i].name);
printf("%s\t",a[i].reg);
printf("%d\t",a[i].marks_dbms);
printf("%d\t\n",a[i].marks_prog);
}
getch();
}
有什么问题吗? – Reinderien 2011-01-30 16:50:45
我不知道是谁教导人们随机缩进。 – 2011-01-30 17:03:35