当前位置: 代码迷 >> C语言 >> 出道题 大家来做做..
  详细解决方案

出道题 大家来做做..

热度:143   发布时间:2004-11-15 12:37:00.0
出道题 大家来做做..

编一个程序,输入月份号,输出该月的英文月名。例如:输入“3”,则输出“March”,要求用指针数组处理


----------------解决方案--------------------------------------------------------

#include "stdio.h"

void main(){ int month=1; static char *English[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; while (month!=0) { printf("please input the month(1~12,0 to quit):"); scanf("%d",&month); if(month>0&&month<=12) printf("%s\n",English[month-1]); else if(month!=0) printf("the month is out of range\n"); } }

该程序可以重复输入,直到输入的月份为0时结束程序.


----------------解决方案--------------------------------------------------------
OK,做的不错!
----------------解决方案--------------------------------------------------------

斑竹要是能多出点这种题目就好了


----------------解决方案--------------------------------------------------------
  相关解决方案