P292 18.编一程序,输入月份号,输出该月的英文月名。例如,输入3,则输出"March",
要求用指针数组处理
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
char* month[13] = { "January","February","March","April","May",
"June","July","August","September","October","November","December" };
int n = 0;
printf("请输入月份号:");
scanf("%d", &n);
if (n >= 1 && n <= 12) {
printf("%s\n", *(month + n - 1));
}
else {
printf("输入的月份号错误");
}
return 0;
}
运行结果: