|
need help
Apologize for being a rookie off top but I am currently writing a program and i have some mathmatical issues. I want to add the sum of all numRooms and let it equal to totRoom and display it for my cout but don't know what exactly to do: here is the program
// Hotel Occupancy
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
void main ()
{
int numRooms, frequency = 1, numTimes,numFloors, totRooms, roomsOccupied, roomsUnoccupied;
float perOccupied;
char nextFloor = 'y';
cout << "How many floors does the hotel have? "; cin >> numFloors;
cout << fixed << showpoint << setprecision (1);
while ( nextFloor != 'n' )
{
clrscr();
cout << "How many rooms are on floor " << frequency <<" ?"; cin >> numRooms;
cout << "How many of floor " << frequency << " rooms are occupied? "; cin >> roomsOccupied;
clrscr();
cout << "next Floor ( yes or no )?\n";
cin >> nextFloor;
totRooms = numRooms +
numTimes = frequency++;
roomsUnoccupied = numTimes - roomsOccupied;
perOccupied = roomsOccupied / totRooms;
cout << "\n\nThe hotel has " << totRooms
<< " rooms\n";
cout << "The hotel has " << roomsOccupied
<< " rooms occupied\n";
cout << "The hotel has " << roomsUnoccupied
<< " rooms unoccupied\n";
cout << "The percentage of the rooms occupied is "
<< perOccupied;
}
getch();
}
|