Program runs fine with me, the cout's work. IDK what this means every cout from line 17 to 71, and the system ("pause") on line 72 are all warning marked as ambigious. It started happenning when i put the "while (occupiedRooms > rooms)" in. I think thats when the errors started popping up. I have no idea why.
thanks
// Hotel occupancy
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double floors = 0,
rooms = 0,
occupiedRooms = 0,
totalRooms = 0,
totalOccupied = 0,
totalVacant = 0,
percentageOccupied = 0.00;
cout << "How many floors? " << endl;
cin >> floors;
//input validation
while (floors < 1)
{ cout << "Must have at least one floor. Try again. " << endl;
cout << "How many floors? " << endl;
cin >> floors ;
}
while (floors > 0)
{
if (floors == 13)//skips 13th floor
floors--;
cout << "How many rooms are on floor " << floors << "?" <<endl;
cin >> rooms;
while (rooms < 10)
{
cout<< "There must be at least 10 rooms per floor. Try again. "<<endl;
cout<< "How many rooms are on floor " << floors << "?" <<endl;
cin >> rooms;
}
cout << "How many rooms on floor "<< floors << " are occupied? " <<endl;
cin >> occupiedRooms;
while (occupiedRooms > rooms)
{
cout << "There cannot be more occupancies than available. Try again. " << endl;
cout << "How many rooms on floor "<< floors << " are occupied? " <<endl;
cin >> occupiedRooms;
}
totalOccupied += occupiedRooms;
{
totalRooms += rooms;
rooms=0;
occupiedRooms=0;
floors--;
}
}
//calculate vancant rooms and percentage occupied
totalVacant = totalRooms-totalOccupied;
percentageOccupied = 100*totalOccupied/totalRooms;
cout << endl << endl;
cout << "Total rooms: " << totalRooms << endl;
cout << "Total occupied: " <<totalOccupied << endl;
cout << "Total vacant: " <<totalVacant<< endl;
cout << showpoint << setprecision(2) << fixed << "Percentage Occupied: " << percentageOccupied << "%" <<endl;
system ("pause");
return 0;
}