为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我这段代码,输出不了 带th的 a 啊? 求大神们帮帮我

为什么我这段代码,输出不了 带th的 a 啊? 求大神们帮帮我

C
黑丶雨 2016-06-20 19:03:17
#include <stdio.h>int main(){        int a,b,c;        CW:printf("请输入日期(格式:日_月_年):");        scanf("%d %d %d",&a,&b,&c);        if(a > 31 || a < 1 || b > 12 || b < 1)        {                printf("输入错误,");                goto CW;        }        else        {                switch(a)                {                        case 1: case 21: case 31:                                printf("%dst ",a);                                break;                        case 2: case 22:                                printf("%dnd ",a);                                break;                        case 3: case 23:                                printf("%drd ",a);                                break;                        defult:                                printf("%dth ",a);                                break;                }                switch(b)                {                        case 1:                                printf("January ");                                break;                        case 2:                                printf("February ");                                break;                        case 3:                                printf("March ");                                break;                        case 4:                                printf("April ");                                break;                        case 5:                                printf("May ");                                break;                        case 6:                                printf("June ");                                break;                        case 7:                                printf("July ");                                break;                        case 8:                                printf("August ");                                break;                        case 9:                                printf("September ");                                break;                        case 10:                                printf("October ");                                break;                        case 11:                                printf("November ");                                break;                        case 12:                                printf("December ");                }        }        printf("%d\n",c);        return 0;}
查看完整描述

2 回答

?
慕粉15222296232

TA贡献3条经验 获得超2个赞

应该是判断出了出了问题,你把if语句中a和b的判断分开,分别判断试试。

查看完整回答
反对 回复 2016-06-21
  • 2 回答
  • 0 关注
  • 1262 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信