#include<stdio.h>
#include<stdlib.h>
char GPA(int score){
if(score>=90) return 'A';
else if(score>=80) return 'B';
else if(score>=70) return 'C';
else return 'D';
}
int main(){
struct student{
char name[15];
int score;
};
struct student student1,student2,student3;
printf("請輸入第一位學生姓名: ");
scanf("%s",student1.name);
printf("請輸入第一位學生成績: ");
scanf("%d",&student1.score);
printf("請輸入第二位學生姓名: ");
scanf("%s",student2.name);
printf("請輸入第二位學生姓名: ");
scanf("%d",&student2.score);
printf("請輸入第三位學生姓名: ");
scanf("%s",student3.name);
printf("請輸入第三位學生姓名: ");
scanf("%d",&student3.score);
printf("第一位學生:%s\n",student1.name);
printf("分數: %d\n",student1.score);
printf("GPA: %c\n",GPA(student1.score));
printf("第二位學生:%s\n",student2.name);
printf("分數: %d\n",student2.score);
printf("GPA: %c\n",GPA(student2.score));
printf("第三位學生:%s\n",student3.name);
printf("分數: %d\n",student3.score);
printf("GPA: %c\n",GPA(student3.score));
system("Pause");
return 0;
}