1
0

usehotel.c 810 B

12345678910111213141516171819202122232425262728293031323334
  1. /* usehotel.c -- room rate program */
  2. /* compile with Listing 9.10 */
  3. #include <stdio.h>
  4. #include "hotel.h" /* defines constants, declares functions */
  5. int main(void)
  6. {
  7. int nights;
  8. double hotel_rate;
  9. int code;
  10. while ((code = menu()) != QUIT)
  11. {
  12. switch(code)
  13. {
  14. case 1 : hotel_rate = HOTEL1;
  15. break;
  16. case 2 : hotel_rate = HOTEL2;
  17. break;
  18. case 3 : hotel_rate = HOTEL3;
  19. break;
  20. case 4 : hotel_rate = HOTEL4;
  21. break;
  22. default: hotel_rate = 0.0;
  23. printf("Oops!\n");
  24. break;
  25. }
  26. nights = getnights();
  27. showprice(hotel_rate, nights);
  28. }
  29. printf("Thank you and goodbye.\n");
  30. return 0;
  31. }