實現輸入月份號輸出該月份的英文名

Varygod發表於2014-12-08

實現輸入月份號輸出該月份的英文名

/***************************************
功能:實現輸入月份號輸出該月份的英文名
日期:2014年12月8日10:27:20
****************************************/
#include<stdio.h>
int main()
{
	char *Month[] = {"January","February","March","April","May","June","Junly","August","September","October","November","December"};
	int i ;
	char **p;//定義指向指標的指標變數p
	p = Month;//將陣列首地址值賦給指標變數p
	printf("Input a number for month\n");
	scanf("%d",&i);
	printf("The month is:");
	printf("%s\n",*(p + i - 1));
	return 0;
} 
/***************************
Input a number for month
9
The month is:September
Press any key to continue
****************************/


相關文章