错误 noname.c 7: 语句缺少';'在 main 函数中
#include"Stdio.h"main(){inta;scanf("%d",&a);swich(a){case1:printf("Monday\n");case2:p...
#include "Stdio.h"
main()
{
int a;
scanf("%d",&a);
swich(a)
{
case 1:printf("Monday\n");
case 2:printf("Tuesday\n");
case 3:printf("Wednesday\n");
case 4:printf("Thursday\n");
case 5:printf("Friday\n");
case 6:printf("Saturday\n");
case 7:printf("Sunday\n");
default:printf("Error\n");
}
getch();
}
我用的是win tc,swich(a)下面那行是第七行,不知道怎么错了,请高手指点~谢谢 展开
main()
{
int a;
scanf("%d",&a);
swich(a)
{
case 1:printf("Monday\n");
case 2:printf("Tuesday\n");
case 3:printf("Wednesday\n");
case 4:printf("Thursday\n");
case 5:printf("Friday\n");
case 6:printf("Saturday\n");
case 7:printf("Sunday\n");
default:printf("Error\n");
}
getch();
}
我用的是win tc,swich(a)下面那行是第七行,不知道怎么错了,请高手指点~谢谢 展开
展开全部
#include <stdio.h>
#include <conio.h> //getch
void main()
{
int a;
scanf("%d",&a);
switch(a) //单词错误
{
case 1:printf("Monday\n");break; // 少了break,这个要记住
case 2:printf("Tuesday\n");break;
case 3:printf("Wednesday\n");break;
case 4:printf("Thursday\n");break;
case 5:printf("Friday\n");break;
case 6:printf("Saturday\n");break;
case 7:printf("Sunday\n");break;
default:printf("Error\n");
}
getch();
return ; // 返回值
}
#include <conio.h> //getch
void main()
{
int a;
scanf("%d",&a);
switch(a) //单词错误
{
case 1:printf("Monday\n");break; // 少了break,这个要记住
case 2:printf("Tuesday\n");break;
case 3:printf("Wednesday\n");break;
case 4:printf("Thursday\n");break;
case 5:printf("Friday\n");break;
case 6:printf("Saturday\n");break;
case 7:printf("Sunday\n");break;
default:printf("Error\n");
}
getch();
return ; // 返回值
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询