/****************************************************************************** * enum.c * CSCI E-52 * Matthew Chartier * * Make use of enumerated types to store finite sets of values. *****************************************************************************/ #include #include typedef enum {WIN, LOSE, DRAW} outcome; outcome check_outcome(int score) { if (score > 9000) return WIN; else if (score < 9000) return LOSE; else return DRAW; } int main(int argc, char *argv[]) { printf("Your opponent has scored 9000 points! What is your score?\n>> "); int score = GetInt(); outcome result = check_outcome(score); if (result == WIN) printf("You scored over 9000! You won!\n"); else if (result == DRAW) printf("Oh. You tied. That's nice...\n"); else printf("FAIL.\n"); return 0; }