/* * File: card2.c * ---------------- * Reads in a number between 1 and 13 and writes out the * appropriate symbol for a playing card of that rank. */ #include #include "genlib.h" #include "simpio.h" main() { int n; printf("What is the rank of the card (1-13)? "); n = GetInteger(); switch (n) { case 1: printf("Ace\n"); break; case 11: printf("Jack\n"); break; case 12: printf("Queen\n"); break; case 13: printf("King\n"); break; case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: printf("%d\n", n); break; default: printf("Bad card number\n"); break; } } ---------------------------------------------------- lassie% a.out What is the rank of the card (1-13)? 1 Ace lassie% a.out What is the rank of the card (1-13)? 14 Bad card number lassie% a.out What is the rank of the card (1-13)? 13 King