Quick!!!c语言:写一函数,要求输入月份号,则输出该月的英文月份。简洁明了最好~谢谢!

来源:百度知道 编辑:UC知道 时间:2024/05/26 02:32:19
运用指针……

#include<stdio.h>

void PrinMonth(int *month);
int main()
{
int mon;
scanf("%d",&mon);
PrinMonth(&mon);
return 0;
}
void PrinMonth(int *month)
{
char emonth[][12]={"January","February","March","April","May","June","July","August","September",
"October","November","December"};
printf("%s",emonth[*month-1]);

}