รบกวนผู้รู้มาต่อยอด ภาษา C หน่อยครับ

คำถาม : จงออกแบบและเขียนโปรแกรมหา GPA ของนักศึกษา 5 คนโดยรบข้อมูล Grade และ Credit จากจำนวนผู้ใช้จำนวน 10 วิชา

แล้วผมทำออกมาได้ดังนี้ครับ :

#include <stdio.h>
#include <stdlib.h>

void main ()
{
int math,eng,com,manage,thai,japan,stat,menu,toyota,tqm,unit1;
float mathgrade,enggrade,comprograde,managegrade,thaigrade,japangrade,statgrade,menugrade,toyotagrade,tqmgrade;
float GPA,sum;
char N,Y,again;

printf("Score Math is : "); scanf("%d",&eng);
if (eng> 100)
{printf("Error \n",eng);}
else if (eng>= 80)
{printf("Your Grate A \n\n",eng);
mathgrade=4.0;}
else if (eng>= 75)
{printf("Your Grate B+\n\n",eng);
mathgrade=3.5;}
else if (eng>= 70)
{printf("Your Grate B \n\n",eng);
mathgrade=3.0;}
else if (eng>= 65)
{printf("Your Grate C+\n\n",eng);
mathgrade=2.5;}
else if (eng>= 60 )
{printf("Your Great C \n\n",eng);
mathgrade=2.0;}
else if (eng>= 55)
{printf("Your Grate D+\n\n",eng);
mathgrade=1.5;}
else if (eng>= 50)
{printf("Your Grate D \n\n",eng);
mathgrade=1.0;}
else if (eng<=49)
{printf("Your Grate F \n\n",eng);
mathgrade=0.0;}


printf("Score English is : "); scanf("%d",&eng);
if (eng> 100)
{printf("Error \n",eng);}
else if (eng>= 80)
{printf("Your Grate A \n\n",eng);
enggrade=4.0;}
else if (eng>= 75)
{printf("Your Grate B+\n\n",eng);
enggrade=3.5;}
else if (eng>= 70)
{printf("Your Grate B \n\n",eng);
enggrade=3.0;}
else if (eng>= 65)
{printf("Your Grate C+\n\n",eng);
enggrade=2.5;}
else if (eng>= 60 )
{printf("Your Great C \n\n",eng);
enggrade=2.0;}
else if (eng>= 55)
{printf("Your Grate D+\n\n",eng);
enggrade=1.5;}
else if (eng>= 50)
{printf("Your Grate D \n\n",eng);
enggrade=1.0;}
else if (eng<=49)
{printf("Your Grate F \n\n",eng);
enggrade=0.0;}

printf("Score Computer Programming is : "); scanf("%d",&com);
if (com> 100)
{printf("Error \n",com);}
else if (com>= 80)
{printf("Your Grate A \n\n",com);
comprograde=4.0;}
else if (com>= 75)
{printf("Your Grate B+\n\n",com);
comprograde=3.5;}
else if (com>= 70)
{printf("Your Grate B \n\n",com);
comprograde=3.0;}
else if (com>= 65)
{printf("Your Grate C+\n\n",com);
comprograde=2.5;}
else if (com>= 60 )
{printf("Your Great C \n\n",com);
comprograde=2.0;}
else if (com>= 55)
{printf("Your Grate D+\n\n",com);
comprograde=1.5;}
else if (com>= 50)
{printf("Your Grate D \n\n",com);
comprograde=1.0;}
else if (com<=49)
{printf("Your Grate F \n\n",com);
comprograde=0.0;}

printf("Score Managementstatgrade is : "); scanf("%d",&manage);
if (manage> 100)
{printf("Error \n",manage);}
else if (manage>= 80)
{printf("Your Grate A \n\n",manage);
managegrade=4.0;}
else if (manage>= 75)
{printf("Your Grate B+\n\n",manage);
managegrade=3.5;}
else if (manage>= 70)
{printf("Your Grate B \n\n",manage);
managegrade=3.0;}
else if (manage>= 65)
{printf("Your Grate C+\n\n",manage);
managegrade=2.5;}
else if (manage>= 60 )
{printf("Your Great C \n\n",manage);
managegrade=2.0;}
else if (manage>= 55)
{printf("Your Grate D+\n\n",manage);
managegrade=1.5;}
else if (manage>= 50)
{printf("Your Grate D \n\n",manage);
managegrade=1.0;}
else if (manage<=49)
{printf("Your Grate F \n\n",manage);
managegrade=0.0;}

printf("Score Thai is : "); scanf("%d",&thai);
if (thai> 100)
{printf("Error \n",thai);}
else if (thai>= 80)
{printf("Your Grate A \n\n",thai);
thaigrade=4.0;}
else if (thai>= 75)
{printf("Your Grate B+\n\n",thai);
thaigrade=3.5;}
else if (thai>= 70)
{printf("Your Grate B \n\n",thai);
thaigrade=3.0;}
else if (thai>= 65)
{printf("Your Grate C+\n\n",thai);
thaigrade=2.5;}
else if (thai>= 60 )
{printf("Your Great C \n\n",thai);
thaigrade=2.0;}
else if (thai>= 55)
{printf("Your Grate D+\n\n",thai);
thaigrade=1.5;}
else if (thai>= 50)
{printf("Your Grate D \n\n",thai);
thaigrade=1.0;}
else if (thai<=49)
{printf("Your Grate F \n\n",thai);
thaigrade=0.0;}

printf("Score japan is : "); scanf("%d",&math);
if (math> 100)
{printf("Error \n\n",math);}
else if (math>= 80)
{printf("Your Grade A \n\n",math);
japangrade=4.0;}
else if (math>= 75)
{printf("Your Grade B+\n\n",math);
japangrade=3.5;}
else if (math>= 70)
{printf("Your Grate B \n\n",math);
japangrade=3.0;}
else if (math>= 65)
{printf("Your Grate C+\n\n",math);
japangrade=2.5;}
else if (math>= 60 )
{printf("Your Great C \n\n",math);
japangrade=2.0;}
else if (math>= 55)
{printf("Your Grate D+\n\n",math);
japangrade=1.5;}
else if (math>= 50)
{printf("Your Grate D \n\n",math);
japangrade=1.0;}
else if (math<=49)
{printf("Your Grate F \n\n",math);
japangrade=0.0;}

printf("Score stat is : "); scanf("%d",&math);
if (math> 100)
{printf("Error \n\n",math);}
else if (math>= 80)
{printf("Your Grade A \n\n",math);
statgrade=4.0;}
else if (math>= 75)
{printf("Your Grade B+\n\n",math);
statgrade=3.5;}
else if (math>= 70)
{printf("Your Grate B \n\n",math);
statgrade=3.0;}
else if (math>= 65)
{printf("Your Grate C+\n\n",math);
statgrade=2.5;}
else if (math>= 60 )
{printf("Your Great C \n\n",math);
statgrade=2.0;}
else if (math>= 55)
{printf("Your Grate D+\n\n",math);
statgrade=1.5;}
else if (math>= 50)
{printf("Your Grate D \n\n",math);
statgrade=1.0;}
else if (math<=49)
{printf("Your Grate F \n\n",math);
statgrade=0.0;}

printf("Score menu is : "); scanf("%d",&math);
if (math> 100)
{printf("Error \n\n",math);}
else if (math>= 80)
{printf("Your Grade A \n\n",math);
menugrade=4.0;}
else if (math>= 75)
{printf("Your Grade B+\n\n",math);
menugrade=3.5;}
else if (math>= 70)
{printf("Your Grate B \n\n",math);
menugrade=3.0;}
else if (math>= 65)
{printf("Your Grate C+\n\n",math);
menugrade=2.5;}
else if (math>= 60 )
{printf("Your Great C \n\n",math);
menugrade=2.0;}
else if (math>= 55)
{printf("Your Grate D+\n\n",math);
menugrade=1.5;}
else if (math>= 50)
{printf("Your Grate D \n\n",math);
menugrade=1.0;}
else if (math<=49)
{printf("Your Grate F \n\n",math);
menugrade=0.0;}

printf("Score toyota is : "); scanf("%d",&math);
if (math> 100)
{printf("Error \n\n",math);}
else if (math>= 80)
{printf("Your Grade A \n\n",math);
toyotagrade=4.0;}
else if (math>= 75)
{printf("Your Grade B+\n\n",math);
toyotagrade=3.5;}
else if (math>= 70)
{printf("Your Grate B \n\n",math);
toyotagrade=3.0;}
else if (math>= 65)
{printf("Your Grate C+\n\n",math);
toyotagrade=2.5;}
else if (math>= 60 )
{printf("Your Great C \n\n",math);
toyotagrade=2.0;}
else if (math>= 55)
{printf("Your Grate D+\n\n",math);
toyotagrade=1.5;}
else if (math>= 50)
{printf("Your Grate D \n\n",math);
toyotagrade=1.0;}
else if (math<=49)
{printf("Your Grate F \n\n",math);
toyotagrade=0.0;}

printf("Score tqm is : "); scanf("%d",&math);
if (math> 100)
{printf("Error \n\n",math);}
else if (math>= 80)
{printf("Your Grade A \n\n",math);
tqmgrade=4.0;}
else if (math>= 75)
{printf("Your Grade B+\n\n",math);
tqmgrade=3.5;}
else if (math>= 70)
{printf("Your Grate B \n\n",math);
tqmgrade=3.0;}
else if (math>= 65)
{printf("Your Grate C+\n\n",math);
tqmgrade=2.5;}
else if (math>= 60 )
{printf("Your Great C \n\n",math);
tqmgrade=2.0;}
else if (math>= 55)
{printf("Your Grate D+\n\n",math);
tqmgrade=1.5;}
else if (math>= 50)
{printf("Your Grate D \n\n",math);
tqmgrade=1.0;}
else if (math<=49)
{printf("Your Grate F \n\n",math);
tqmgrade=0.0;}

GPA=(mathgrade+enggrade+comprograde+managegrade+thaigrade+japangrade+statgrade+menugrade+toyotagrade+tqmgrade);
sum=(GPA*3)/30;
printf("GPA is %.1f\n\n",sum);

if(sum>=3.5){
printf(" ***************************\n");
printf(" Your \n");
printf(" First Class Honor\n");
printf(" Congratulation\n");
printf(" ***************************");}
else if(sum>=3.0){
printf(" ***************************\n");
printf(" Your \n");
printf(" Second Class Honor\n");
printf(" Congratulation\n");
printf(" ***************************\n"); }
else if(sum>=2.00) {
printf(" ***************************\n");
printf(" Your \n");
printf(" Commencement\n");
printf(" Congratulation\n");
printf(" ***************************\n"); }
else if (sum<=1.99) {
printf(" Retire \n");
printf(" So sorry\n");
printf(" Please Contact to ACAD of Naresuan University ");}
else
printf(" Key Again");

getch();

}

ซึ่งผมอยากใส่ชื่อของนักเรียน 5 คน เป็น A,B,C,D,E ตามลำดับ แล้ว run โปรแกรมทีละคนโดยไม่ต้องออกโปรแกรม ควรทำไงต่อครับรบกวนหน่อยครับ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่