switch语句内容,到底是哪里错了呢?
黄庭浩 高级粉丝 2018-12-01 11:20:42
2897 4 0

switch(month)

{

case 2:

days = 28;break;

case 4 :csae  6:case  9:case 11:

days = 30;break;

default:

days =31;break;

}

prntf("%d天\n", days)

提示:

--------------------Configuration: HN2 - Win32 Debug--------------------

Compiling...

HN2.c

c:\users\1\desktop\c语言学习\hn2.c(1) : error C2059: syntax error : 'switch'

c:\users\1\desktop\c语言学习\hn2.c(10) : error C2143: syntax error : missing ')' before 'string'

c:\users\1\desktop\c语言学习\hn2.c(10) : error C2143: syntax error : missing '{' before 'string'

c:\users\1\desktop\c语言学习\hn2.c(10) : error C2059: syntax error : '<Unknown>'

c:\users\1\desktop\c语言学习\hn2.c(10) : error C2059: syntax error : ')'

执行 cl.exe 时出错.


HN2.obj - 1 error(s), 0 warning(s


问题来自: switch语句

共 4 个回答

    【C语言】桦桦 人气新星 1992天前

    你前面有没有

    #include 
    int main()
    {
       int month,day;
       scanf("%d",&month);
    这个,要是有的话,不是语句的问题,应该是中英文符号转化,
    c:\users\1\desktop\c语言学习\hn2.c(1) : error C2059: syntax error : 'switch'
    c:\users\1\desktop\c语言学习\hn2.c(10) : error C2143: syntax error : missing ')' before 'string'
    c:\users\1\desktop\c语言学习\hn2.c(10) : error C2143: syntax error : missing '{' before 'string'
    c:\users\1\desktop\c语言学习\hn2.c(10) : error C2059: syntax error : '<Unknown>'
    c:\users\1\desktop\c语言学习\hn2.c(10) : error C2059: syntax error : ')'
    执行 cl.exe 时出错.
    
    HN2.obj - 1 error(s), 0 warning(s

    上面这些是错误,你在上面几行中选中其中一行,双击就找到错误地方了

    黄庭浩 高级粉丝 1992天前

    回复 【C语言】桦桦

    #include 
    int main()
    {
       int month,day;
       scanf("%d",&month)

    加这个?不行呀.....

    【C语言】桦桦 人气新星 1991天前

    回复 黄庭浩:把你全部的代码复制过来我瞅瞅

    【C语言】桦桦 人气新星 1929天前

    回复 :少了头文件

您还没有登录,所以不能回复该问题
我要回复

  • 0

    点赞

  • 扫一扫分享朋友圈

    二维码

  • 分享

相关问题