本文介绍了怎么能在switchcase中做到这一点?请帮帮我,谢谢......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include < stdio.h >
int QZ1,QZ2,QZ3,QZ4,ME,FE,ATT,CS;
float G,PQZS = 0 。 40 ,PFME = 0 。 40 ,PAT = 0 。 10 ,PCS = 0 。 10 ,QAVE,FME,FAT,FCS,Equiv,备注,通过,失败;
int main()
{
printf( 输入测验1:);
scanf( %d,& QZ1);
printf( 输入测验2:);
scanf( %d,& QZ2);
printf( 输入测验3:);
scanf( %d,& QZ3);
printf( 输入测验4:);
scanf( %d,& QZ4);
printf( 输入期中考试结果:);
scanf( %d,& ME);
printf( 输入期末考试结果:);
scanf( %d,& FE);
printf( 输入出勤等级:);
scanf( %d,& ATT);
printf( 输入班级等级:);
scanf( %d,& CS);
QAVE =((QZ1 + QZ2 + QZ3 + QZ4)/ 4)* PQZS;
printf( \ nQuiz Average:%。2f,QAVE);
FME =((ME + FE)/ 2)* PFME;
printf( \ nMajor考试:%。2f,FME);
FAT = ATT * PAT;
printf( \\\
Attendance:%。2f,FAT);
FCS = CS * PCS;
printf( \ nClass Standing:%。2f,FCS);
G = QAVE + FME + FAT + FCS;
printf( \ nGrade:%。2f,G);
switch (等级)
{
case ' G> = 98':
Equiv = 4 。 00 ;
printf( \ nEquivalent:%。2f,Equiv);
printf( \ nRemark:Passed,备注);
break ;
case ' G> = 91':
Equiv = 3 。 75 ;
printf( \ nEquivalent:%。2f,Equiv);
printf( \ nRemark:Passed,备注);
break ;
case ' G> = 83':
Equiv = 2 。 75 ;
printf( \ nEquivalent:%。2f,Equiv);
printf( \ nRemark:Passed,备注);
break ;
case ' G> = 76':
Equiv = 2 。 25 ;
printf( \ nEquivalent:%。2f,Equiv);
printf( \ nRemark:Passed,备注);
break ;
case ' G = = 75':
Equiv = 2 。 00 ;
printf( \ nEquivalent:%。2f,Equiv);
printf( \ nRemark:Passed,备注);
break ;
case ' G< 75':
Equiv = 1 。 00 ,备注;
printf( \ nEquivalent:%。2f,Equiv);
printf( \ nRemark:失败,备注);
break ;
}
return ( 0 );
}
我的尝试:
我试过这样做但没跑。请帮帮我吧伙计们谢谢...
解决方案
#include<stdio.h> int QZ1, QZ2, QZ3, QZ4, ME, FE, ATT, CS; float G, PQZS=0.40, PFME=0.40, PAT=0.10, PCS=0.10, QAVE, FME, FAT, FCS, Equiv, Remark, Passed, Failed; int main() { printf("Enter Quiz No.1:"); scanf("%d",&QZ1); printf("Enter Quiz No.2:"); scanf("%d",&QZ2); printf("Enter Quiz No.3:"); scanf("%d",&QZ3); printf("Enter Quiz No.4:"); scanf("%d",&QZ4); printf("Enter Midterm Exam Result:"); scanf("%d",&ME); printf("Enter Final Exam Result:"); scanf("%d",&FE); printf("Enter Grade for Attendance:"); scanf("%d",&ATT); printf("Enter Grade for Class Standing:"); scanf("%d",&CS); QAVE=((QZ1+QZ2+QZ3+QZ4)/4)*PQZS; printf("\nQuiz Average:%.2f",QAVE); FME=((ME+FE)/2)*PFME; printf("\nMajor Exam:%.2f",FME); FAT=ATT*PAT; printf("\nAttendance:%.2f",FAT); FCS=CS*PCS; printf("\nClass Standing:%.2f",FCS); G=QAVE+FME+FAT+FCS; printf("\nGrade:%.2f",G); switch(Grade) { case 'G>=98': Equiv=4.00; printf("\nEquivalent:%.2f",Equiv); printf("\nRemark:Passed",Remark); break; case 'G>=91': Equiv=3.75; printf("\nEquivalent:%.2f",Equiv); printf("\nRemark:Passed",Remark); break; case 'G>=83': Equiv=2.75; printf("\nEquivalent:%.2f",Equiv); printf("\nRemark:Passed",Remark); break; case 'G>=76': Equiv=2.25; printf("\nEquivalent:%.2f",Equiv); printf("\nRemark:Passed",Remark); break; case 'G==75': Equiv=2.00; printf("\nEquivalent:%.2f",Equiv); printf("\nRemark:Passed",Remark); break; case 'G<75': Equiv=1.00, Remark; printf("\nEquivalent:%.2f",Equiv); printf("\nRemark:Failed",Remark); break; } return (0); }
What I have tried:
I tried to do it but did not run. please help me now guysss thank you...
解决方案
这篇关于怎么能在switchcase中做到这一点?请帮帮我,谢谢......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!