微型计算机 编程题

来源:百度知道 编辑:UC知道 时间:2024/09/25 20:06:14
试用子程序结构编写一程序:从键盘输入一个2位十进制的月份数(01~12),然后显示出相应的英文缩写名.

#include <stdio.h>
#include <conio.h>
main()
{
char mon[][4]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
int i;
printf("\nInput month(01~12):");
scanf("%d",&i);

printf("%s",mon[i-1]);
getch();
}