#include <stdio.h> #define MONTHS 12 int main() { int days[MONTHS]={31,28,31,30,31,30,31,31,30,31,31,30}; int index; for (index=0;index<MONTHS;index++) printf("Class %2d has %d students.\n",index+1,*(days+index)); return 0; }
时间: 2024-09-28 17:19:49
#include <stdio.h> #define MONTHS 12 int main() { int days[MONTHS]={31,28,31,30,31,30,31,31,30,31,31,30}; int index; for (index=0;index<MONTHS;index++) printf("Class %2d has %d students.\n",index+1,*(days+index)); return 0; }