从键盘任意输入一个整型表示的月份值,用指针数组编程输出该月份的英文表示,若输入的月份值不在1~12
从键盘任意输入一个整型表示的月份值,用指针数组编程输出该月份的英文表示,若输入的月份值不在1~12之间,则输出“Illegalmonth”...
从键盘任意输入一个整型表示的月份值,用指针数组编程输出该月份的英文表示,若输入的月份值不在1~12之间,则输出“Illegal month”
展开
2个回答
展开全部
#include<stdio.h>
int main()
{int m;
char *s[13]={"","Jan","Fab","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
scanf("%d",&m);
if(m>0&&m<13)printf("%s\n",s[m]);
else printf("Illegal month\n");
return 0;
}
int main()
{int m;
char *s[13]={"","Jan","Fab","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
scanf("%d",&m);
if(m>0&&m<13)printf("%s\n",s[m]);
else printf("Illegal month\n");
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询