标签:scanf number include amp 指针 ali may arc pre
//月份与数字之间的对应; //switch case语句 //指针数组 #include <stdio.h> int main() { char * month[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; int i; puts("input month number 1 - 12"); scanf("%d", &i); --i; switch (i) { case 0: puts(month[0]); break; case 1: puts(month[1]); break; case 2: puts(month[2]); break; case 3: puts(month[3]); break; case 4: puts(month[4]); break; case 5: puts(month[5]); break; case 6: puts(month[6]); break; case 7: puts(month[7]); break; case 8: puts(month[8]); break; case 9: puts(month[9]); break; case 10: puts(month[10]); break; case 11: puts(month[11]); break; default: puts("invalid number!"); } return 0; }
标签:scanf number include amp 指针 ali may arc pre
原文地址:https://www.cnblogs.com/profesor/p/13089560.html