发布网友 发布时间:3分钟前
共1个回答
热心网友 时间:5分钟前
#include <stdio.h>
#include <conio.h>
int main()
{
int n;
static char month[][14]={
"Illegal month",
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
scanf("%d",&n);
printf("%s\n",(n<1||n>12)?month[0]:month[n]);
getch();
return 0;
}
将 scanf("%d",&n); 移到 字符串数组 的后面就可以了.
C语言的变量声明只能在函数体前面.