首页 热点资讯 义务教育 高等教育 出国留学 考研考公

我有几个小问题关于这个c语言程序.谁能帮我解答下?谢谢了!

发布网友 发布时间:2022-04-24 18:31

我来回答

2个回答

热心网友 时间:2023-11-01 13:54

#include<stdio.h>
#include<conio.h>
main()
{
char a,b,c;
clrscr();
printf("Do you have Experience with C? Press y/n\n");
scanf("%c",&a);
fflush(stdin);//添加,清空缓冲区
switch(a)//有错
{
case 'N':
case 'n':printf("We are so sorry tell you...");break;
case 'Y':
case 'y':printf("What is your bachelor degree? Press y/n\n");
scanf("%c",&b);
fflush(stdin);//添加,清空缓冲区
switch(b)//有错
{
case 'N':
case 'n':printf("We are so sorry to tell you...");break;
case 'Y':
case 'y':printf("Your age less than 30? Press y/n\n");
scanf("%c",&c);
fflush(stdin);//添加,清空缓冲区
switch(c)//有错
{
case 'N':
case 'n':printf("We are so sorry to tell you...");break;
case 'Y':
case 'y':printf("Welcome join us!");
}
}
}
getch();
}

热心网友 时间:2023-11-01 13:54

已测试
#include<stdio.h>
#include<conio.h>
main()
{
char a,b,c;
clrscr();
printf("Do you have Experience with C? Press y/n\n");
scanf("%c",&a);
getchar();
switch(a)
{
case 'N':
case 'n':printf("We are so sorry tell you...");break;
case 'Y':
case 'y':printf("What is your bachelor degree? Press y/n\n");scanf("%c",&b);getchar();
switch(b)
{
case 'N':
case 'n':printf("We are so sorry to tell you...");break;
case 'Y':
case 'y':printf("Your age less than 30? Press y/n\n");scanf("%c",&c);getchar();
switch(c)
{
case 'N':
case 'n':printf("We are so sorry to tell you...");break;
case 'Y':
case 'y':printf("Welcome join us!");
}
}
}
getch();
}

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com