编一程序,输入月份号,输出该月的英文月名。例如:输入“3”,则输出“March”,要求用指针数组处理

如题所述

void main(){
int n;
char *name[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
scanf("%d",&n);
printf("%s\n",name[n+1]);
}
温馨提示:内容为网友见解,仅供参考
第1个回答  2012-07-03
#include<stdio.h>
int main()
{
void match(char *name[],int n);
int mouth;
char *name[]={"January","February","March","April","May","June","July","August","September","October","November","December"};
printf("请输入月份号:\n");
scanf("%d",&mouth);
match(name,mouth);
return 0;
}

void match(char *name[],int n)
{
printf("%s\n",name[n-1]);
}
第2个回答  2019-10-16
你定义一个变量,用来存放输入的数字

然后用if或switch语句来判断输入的数字的值,然后输出相应的字符串。
第3个回答  2019-10-26
这个真心不会
相似回答