字符串数组2020-05-21
#include <stdio.h>
char *str[]={"January","Febuary","March","April","May","June","July","August","September","October","Noverber","Decenber"};
//字符串数组 数组里的元素是字符串
int main(void)
{
int month;
printf("请输入月份\n");
scanf("%d",&month);
switch(month)
{
case 0:printf("%s",str[0]);break;
case 1:printf("%s",str[1]);break;
case 2:printf("%s",str[2]);break;
case 3:printf("%s",str[3]);break;
case 4:printf("%s",str[4]);break;
case 5:printf("%s",str[5]);break;
case 6:printf("%s",str[6]);break;
case 7:printf("%s",str[7]);break;
case 8:printf("%s",str[8]);break;
case 9:printf("%s",str[9]);break;
case 10:printf("%s",str[10]);break;
case 11:printf("%s",str[11]);break;
}
return 0;
}