键盘输入月份号,输出该月的英文月份名 当输入的月份号小于0或大于12时,为输出错误信息,输入0则信息终止 目前只学过循环跟数组#include<;stdio.h>;void main(){ int month;。
用switch语句从键盘输入一个月份,自动显示该月份的英文名称!C语言的 #includeint main(void){int n;printf(\"请输入月份数字:\");scanf(\"%d\",&n);switch(n){case 1:printf(\"January\\n\");break;case 2:printf(\"February\\n\");break;case 3:printf(\"March\\n\");break;case 4:printf(\"April\\n\");break;case 5:printf(\"May\\n\");break;case 6:printf(\"June\\n\");break;case 7:printf(\"July\\n\");break;case 8:printf(\"August\\n\");break;case 9:printf(\"September\\n\");break;case 10:printf(\"October\\n\");break;case 11:printf(\"November\\n\");break;case 12:printf(\"December\\n\");break;default:printf(\"输入错误!break;}return 0;}
编写程序,从键盘输入月份号,输出该月的英文名字\\n输出要求用函数实现。 #include\"stdio.hchar*getMonthName(int month){char*params[]={\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",July\",\"August\",\"September\",\"October\",\"November\",\"December\"};return params[month-1];}void main(){int month;char name[10];printf(\"input month(1~12):\");scanf(\"%d\",&month);strcpy(name,getMonthName(month));printf(\"%d:%s\\n\",month,name);}测试:input month(1~12):99:September
用指针数组处理的c程序,实现从键盘输入月份时输出对应的英文名。例如,从键盘输入3时,则输出Marh
如何用键盘输入数字月份,输出英文月份? main(){int i;printf(\"请输入数字的月份e68a84e8a2ade799bee5baa631333332636437:\");scanf(\"%d\",&i);switch(i){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\");break;}}
如何用键盘输入数字月份,输出英文月份?用switch做~main(){ int i;printf(请输入数字的月份:);scanf(%d,&i);switch(i){ case '1':printf(January);break;。