标题:运行错误,无论你输入啥都只输出一种情况,求解
取消只看楼主
不吃洋葱
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2021-11-18
结帖率:100%
已结贴  问题点数:10 回复次数:1 
运行错误,无论你输入啥都只输出一种情况,求解
#include<stdio.h>
int main()
{
    int iMonth=0,iDay=0;
    printf("enter the month you want to know the days\n");
    scanf("%d",&iMonth);
    switch(iMonth)
    {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            iDay=31;
            break;
        case 4:
        case 6:
        case 9:
        case 11:
            iDay=30;
            break;
        case 2:
            iDay=28;
            break;
        default:
            iDay=-1;
            break;
    }
    if(iDay=-1)
    {
        printf("there is a error with you enter\n");
    }
    else
    {
        printf("2010.%d has %d days\n",iMonth,iDay);
    }
    return 0;
}
搜索更多相关主题的帖子: 输入 运行 printf break case 
2021-11-19 19:29
不吃洋葱
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2021-11-18
得分:0 
回复 2楼 apull
两个=号吗,还是不行啊
2021-11-19 22:22



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-507584-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.176905 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved