คือ ว่า หนูเขียนโค้ดเรื่องการลงทะเบียนเรียน แต่ที่มีปัญหาคือ เมื่อเรากดลงทะเบียนเลือกวิชาแล้ว
ต้องการให้รวมเป็นเงินทั้งหมดเท่าไหร่ ช่วยดูโค้ดให้หน่อยได้ไหมค่ะ ต้องใช้คำสั่งอะไรหรือกำหนดตัวแปรแบบไหน


โค้ดค่ะ
printf("\n Please select subject(a-f) : ",&num);
scanf("%d",&num);
ch=getche();
printf("\n");
int a,b,c,d,e,f;
if(ch=='a')
{printf("\n BME384 princicle of biomedical Credit : 3 Monday 9.00-12.00 AM ");}
if(ch=='b')
{printf("\n BME357 biomedical sensor Credit : 3 Tuesday 9.00-12.00 AM");}
if(ch=='c')
{printf("\n BME202 physiology for biomedical Credit : 2 Tuesday 13.00-15.00 PM");}
if(ch=='d')
{printf("\n HUM114 contemporary thai history Credit : 3 Thursday 9.00-12.00 AM");}
if(ch=='e')
{printf("\n EEN351 electronic1 Credit : 3 Wednesday 9.00-12.00 AM");}
if(ch=='f')
{printf("\n EEN353 lab electronic1 Credit : 1 Wednesday 13.00-16.00 PM");}
if(ch!='a'&&ch!='b'&&ch!='c'&&ch!='d'&&ch!='e'&&ch!='f'){
printf("No result found");}
float total;
int fee; fee=5000;
total= a+5000;
printf("\n-------------------------------------------------------------------------------");
printf("\nTotal to be paid :%f\n",&total);
ช่วยแนะนำการเขียนโค้ดภาษา C++
ต้องการให้รวมเป็นเงินทั้งหมดเท่าไหร่ ช่วยดูโค้ดให้หน่อยได้ไหมค่ะ ต้องใช้คำสั่งอะไรหรือกำหนดตัวแปรแบบไหน
โค้ดค่ะ
printf("\n Please select subject(a-f) : ",&num);
scanf("%d",&num);
ch=getche();
printf("\n");
int a,b,c,d,e,f;
if(ch=='a')
{printf("\n BME384 princicle of biomedical Credit : 3 Monday 9.00-12.00 AM ");}
if(ch=='b')
{printf("\n BME357 biomedical sensor Credit : 3 Tuesday 9.00-12.00 AM");}
if(ch=='c')
{printf("\n BME202 physiology for biomedical Credit : 2 Tuesday 13.00-15.00 PM");}
if(ch=='d')
{printf("\n HUM114 contemporary thai history Credit : 3 Thursday 9.00-12.00 AM");}
if(ch=='e')
{printf("\n EEN351 electronic1 Credit : 3 Wednesday 9.00-12.00 AM");}
if(ch=='f')
{printf("\n EEN353 lab electronic1 Credit : 1 Wednesday 13.00-16.00 PM");}
if(ch!='a'&&ch!='b'&&ch!='c'&&ch!='d'&&ch!='e'&&ch!='f'){
printf("No result found");}
float total;
int fee; fee=5000;
total= a+5000;
printf("\n-------------------------------------------------------------------------------");
printf("\nTotal to be paid :%f\n",&total);