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;
}

They are not errors, they are "intellisense" errors. The program executes fine and from what i have tried, it seems like there are no holes, I think i covered all invalid inputs.

SO I ran the program one last time. start to finish. All the "errors" dissappeared. IDK what was going on there. It had me worried. I didnt change any code so I guess the errors didnt clear because I didnt test every path of logic?

Sometimes those Intellisense errors\warnings take a little time to disappear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.