编一程序,输入月份号,输出该月的英文月名。要求用指针数组处理。

提示:正确的月份英文
January
February
March
April
May
June
July
August
September
October
November
December

建一个字符串数组,数组下标号码 对应月份,里面存该月份 英文词即可。
c 语言程序如下:
#include <stdio.h>
int main(){
char *sm[13]={" ","January","February",
"March","April","May","June",
"July","August","September",
"October","November","December"};
int i,m;
printf("input month 1 or 2 or ..or 12\n");
scanf("%d",&m);
printf("It is: %s\n", *(sm+m));
return 0;
}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答