编写一个程序,输入月份号,输出该月的英文月名

#include<stdio.h>
int main()
{
	char*month_name[13]={"illegal month","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_name+n));
	}
	else
	{
		printf("it is wrong.\n");
	}
	return 0;
}

你可能感兴趣的:(数组,指针,if)