标题:为什么这个程序不出结果
取消只看楼主
嗯enen
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2020-3-17
结帖率:0
已结贴  问题点数:20 回复次数:0 
为什么这个程序不出结果
#include <stdio.h>
int main()
{
    int a,b,c,d;
    printf("请输入三个正数:");
    scanf("%d%d%d",a,b,c);
    d=a%10;
    printf("%d",d);
    if(d==1)
    {
        switch(b){
            case 1:printf("%dst January %d",a,c+1900);break;
            case 2:printf("%dst February %d",a,c+1900);break;
            case 3:printf("%dst March %d",a,c+1900);break;
            case 4:printf("%dst April %d",a,c+1900);break;
            case 5:printf("%dst May %d",a,c+1900);break;
            case 6:printf("%dst June %d",a,c+1900);break;
            case 7:printf("%dst July %d",a,c+1900);break;
            case 8:printf("%dst August %d",a,c+1900);break;
            case 9:printf("%dst September %d",a,c+1900);break;
            case 10:printf("%dst October %d",a,c+1900);break;
            case 11:printf("%dst November %d",a,c+1900);break;
            case 12:printf("%dst December %d",a,c+1900);break;
            }
    }else if(d==2)
    {
            switch(b){
            case 1:printf("%dnd January %d",a,c+1900);break;
            case 2:printf("%dnd February %d",a,c+1900);break;
            case 3:printf("%dnd March %d",a,c+1900);break;
            case 4:printf("%dnd April %d",a,c+1900);break;
            case 5:printf("%dnd May %d",a,c+1900);break;
            case 6:printf("%dnd June %d",a,c+1900);break;
            case 7:printf("%dnd July %d",a,c+1900);break;
            case 8:printf("%dnd August %d",a,c+1900);break;
            case 9:printf("%dnd September %d",a,c+1900);break;
            case 10:printf("%dnd October %d",a,c+1900);break;
            case 11:printf("%dnd November %d",a,c+1900);break;
            case 12 :printf("%dnd December %d",a,c+1900);break;
        }
    }else if(d==3)
    {
            switch(b){
            case 1:printf("%drd January %d",a,c+1900);break;
            case 2:printf("%drd February %d",a,c+1900);break;
            case 3:printf("%drd March %d",a,c+1900);break;
            case 4:printf("%drd April %d",a,c+1900);break;
            case 5:printf("%drd May %d",a,c+1900);break;
            case 6:printf("%drd June %d",a,c+1900);break;
            case 7:printf("%drd July %d",a,c+1900);break;
            case 8:printf("%drd August %d",a,c+1900);break;
            case 9:printf("%drd September %d",a,c+1900);break;
            case 10:printf("%drd October %d",a,c+1900);break;
            case 11:printf("%drd November %d",a,c+1900);break;
            case 12:printf("%drd December %d",a,c+1900);break;
        }
    }else {
            switch(b){
            case 1:printf("%dth January %d",a,c+1900);break;
            case 2:printf("%dth February %d",a,c+1900);break;
            case 3:printf("%dth March %d",a,c+1900);break;
            case 4:printf("%dth April %d",a,c+1900);break;
            case 5:printf("%dth May %d",a,c+1900);break;
            case 6:printf("%dth June %d",a,c+1900);break;
            case 7:printf("%dth July %d",a,c+1900);break;
            case 8:printf("%dth August %d",a,c+1900);break;
            case 9:printf("%dth September %d",a,c+1900);break;
            case 10:printf("%dth October %d",a,c+1900);break;
            case 11:printf("%dth November %d",a,c+1900);break;
            case 12:printf("%dth December %d",a,c+1900);break;
    }
   
   

}
}
搜索更多相关主题的帖子: printf case 结果 switch break 
2020-03-17 14:49



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




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

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