1、
#include <stdio.h> enum info { Gender, Season, Age, Invalid}; void gender(void) { puts("male. "); } void season(void) { puts("summer. "); } void age(void) { puts("30. "); } enum info select(void) { enum info tmp; do { puts("0: gender 1: season 2: age 3: quit."); printf("tmp = "); scanf("%d", &tmp); } while(tmp < Gender || tmp > Invalid); return tmp; } int main(void) { enum info a; do { switch(a = select()) { case Gender : gender(); break; case Season : season(); break; case Age : age(); break; } } while(a != Invalid); return 0; }