剛剛學習c語言,還請各位大佬能指教一二,在這提前謝謝各位大佬??
可能圖片看不清,發下源代碼吧。
#include<stdio.h>
int main()
{
struct student
{
int num;
char name[20];
int score;
}a[2];
printf("Please input the students infornation:\n");
for(int i=0;i<2;i++)
scanf_s("%d,%s,%d", &a[i].num, &a[i].name,20, &a[i].score);
printf("The higher student score is:");
if (a[0].score > a[1].score)
printf("%d %s %d", a[0].num, a[0].name, a[0].score);
else
if (a[0].score < a[1].score)
printf("%d %s %d",a[1].num, a[1].name, a[1].score);
//else printf("They get the same score");
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/245953.html
標籤:C語言
