问题描述:
编写一程序,输入月份号,输出该月的英文月份名,要求用指针数组处理。
输入样例:
3
输出样例:
March
输入样例:
18
输出样例:
wrong
#include <stdio.h>
int main()
{
char *months[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
int n;
scanf("%d",&n);
if(n>=1&&n<13)
printf("%s",months[n-1]);
else
printf("wrong");
return 0;
}