-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusehotel.c
More file actions
39 lines (36 loc) · 845 Bytes
/
usehotel.c
File metadata and controls
39 lines (36 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* usehotel.c -- room rate program */
/* compile with Listing 9.10 */
#include <stdio.h>
#include "hotel.h" /* defines constants, declares functions */
int main(void)
{
int nights;
double hotel_rate;
int code;
while ((code = menu()) != QUIT)
{
switch(code)
{
case 1:
hotel_rate = HOTEL1;
break;
case 2:
hotel_rate = HOTEL2;
break;
case 3:
hotel_rate = HOTEL3;
break;
case 4:
hotel_rate = HOTEL4;
break;
default:
hotel_rate = 0.0;
printf("OOPS!\n");
break;
}
nights = getnights();
showprice(hotel_rate, nights);
}
printf("Thank you and goodbye.\n");
return 0;
}