#define N 5
struct student1
{
long num;
char name[10];
int sorce[2];
int total;
}student[N];
main()
{
int i, j;
struct student1 temp;
printf("请输入学生的基本信息");
printf("num\tname\tsorce1\tsorce2\n");
for (i = 0; i < N; i++)
{
scanf_s("%ld,%s,%d,%d", &student[i].num, student[i].name,10, &student[i].sorce[0], &student[i].sorce[1]);
student[i].total = student[i].sorce[1] + student[i].sorce[0];
}
for (i = 0; i<N - 1; i++)
for (j = 0; j<N - i - 1; j++)
if (student[j].total < student[j + 1].total)
{
temp = student[j];
student[j] = student[j + 1];
student[j + 1] = temp;
}
for (i = 0; i < N; i++)
printf("%ld\n%s\n%d\n%d\n%d", student[i].num, student[i].name, student[i].sorce[0], student[i].sorce[1], student[i].total);
system("pause");
}
为什麽我在编译的时候vs2015报错但是运行了程序却没有得到想要的结果