char strMonth[][5]={"Jan",".",".","..."};//12 month nameint month;printf("please input month:\n");scanf("%d",&month);printf("\n %s\n",strMonth[month]);
先定义一个长度为12的字符串数组,各元素分别为"Jan","Feb"..."Dec",然后对输入的整数switch