代码:
#include <stdio.h>
int main(){
char *month[12]={"January","February","March","April","May" ,"June",
"July" ,"August","September" ,"October","November","December"};
int n;
printf("input month:\n");
scanf("%d",&n);
if ((n<=12)&&(n>=1))
printf("It is %s. \n", *(month+n-1));
else
printf("It is wrong. \n");
return 0;
}
运行结果: