用if语句和switch语句分别编写程序,实现以下功能:从键盘输入数字1,2,3,4,分别显示Excellent,Good,Pass,

2024-12-03 18:18:23
推荐回答(4个)
回答1:

if A = 1 then
output= "excellent"
elseif A =2 then ...........
end if
------------------------------------------------------------------------
switch case A
case 1
output= "excellent"
case 2
output="Good"
case 3
output="pass"

回答2:

#include
void main()
{
int choice;
do
{
scanf("%d",&choice);
}while(choice<1||choice>4);
switch(choice)
{
case 1:printf("Excellent\n");break;
case 2:printf("Good\n");break;
case 3:printf("Pass\n");break;
case 4:return;
}
}

回答3:

请参照课本自己写,这种东西很简单的

回答4:

你用java还是c语言阿?