Hey guys -
I'm trying to write a program for class that calculates number of unoccupied and occupied rooms in a hotel, how many floors in the hotel etc..
The problem I'm having is getting the program to skip the 13th floor, since most hotels don't have one. I tried putting in an 'if' statement telling it to continue if the value of 'floors == 13', but that didn't work. Any ideas?
Here's the source code:
// Hotel Occupancy Calculator
// Jen Tonon
// This program calculates the occupancy rate for rooms in a hotel.
using namespace std;
int floors, count=1, count2=1, occupied, rooms; //Number of floors, rooms
//and increment counters.
double total, total2;
cout << "Please enter the number of floors in the hotel\n";
cin >> floors;
while (count <= floors)
cout << "Enter the number of rooms on floor " << count << ": ";
cin >> rooms;
total += rooms;
cout << "Enter the number of occupied rooms on floor " << count2 << ": ";
cin >> occupied;
total2 += occupied;
cout << "The total number of rooms in this hotel are: " << total << endl;
cout << "The total number of occupied rooms in this hotel are: " << total2 << endl;
cout << "The total number of unoccupied rooms in this hotel are: " << total - total2 << endl;
cout << "The percentage of unoccupied rooms is: " << (total - total2) / total << " %" << endl;