#include<stdio.h>
#define MONTHS 12//定义宏变量
int main()
{
int days[MONTHS]={31,28,31,30,31,30,31,31,30,31,30,31};
int month;
do
{
printf("input a month:");
scanf("%d",&month);
}while(month<1||month>12);//处理不合法的数据的输入
printf("%d",days[month-1]);//定义数组a[n]它的下标实际是a[0]到a[n-1]在定义下面代码中不能出现a[n]
return 0;
}