习题11-1 输出月份英文名 (15 分)
#include <stdio.h> char *getmonth(int n); int main() { int n; char *s; scanf("%d", &n); s = getmonth(n); if (s == NULL) printf("wrong input!\n"); else printf("%s\n", s); system("pause"); return 0; } /* 你的代码将被嵌在这里 */ char *getmonth(int n) { char *month[13] = { "0", "January", "February", "March", "June", "July", "August", "September", "October", "November", "December" }; if (n < 1 || n > 12) return NULL; else return month[n]; }

浙公网安备 33010602011771号