编一程序,输人月份号,输出该月的英文月名。例如,输人3,则输出March。要求用指针数组处理。
作者:互联网
代码:
#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;
}
运行结果:
标签:编一,输出,March,int,month,char,printf 来源: https://blog.csdn.net/weixin_48199671/article/details/121963713