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

#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;
}


黑丶雨
浏览 1263回答 2
2回答

慕粉15222296232

应该是判断出了出了问题,你把if语句中a和b的判断分开,分别判断试试。
打开App,查看更多内容
随时随地看视频慕课网APP