发布网友 发布时间:2024-10-20 04:06
共1个回答
热心网友 时间:2024-10-20 04:04
#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语言的变量声明只能在函数体前面.