All my programs run by using gcc. Please help with this program using the format
ID: 3658079 • Letter: A
Question
All my programs run by using gcc. Please help with this program using the format I have below. I need a screen shot of the program running soI know what I am looking for. If possible switch this program to scanf,printf and if statements. #includeusing namespace std; int main() { int floors = 6, rooms = 20, suites = 120, occupied = 0, totalRooms = 0, totalOccupied = 0, totalUnoccupied = 0; double occupRate=0.0; //store hotel occupancy rate for (int floor = 10; floor <= numFloors; floor++) //initiate loop { cout << "Enter the number of rooms occupied on " << floor << "floor. " cin >> occupied; totOccupied += occupied; //number of rooms in each floor will be added to totalRooms totalUnoccupied = totalRooms - totalOccupied; //store total of unoccupied rooms in hotel occupRate= static_cast(totalOccupied) / totalRooms; //store occupancy rate cout << " The hotel has " << totalRooms << " rooms. "; cout << totalOccupied << " rooms are occupied. "; cout << totalUnoccupied << " rooms are unoccupied. "; cout << occupRate*100 << "% of the rooms are occupied. "; //display occupancy rate in percentage format return 0; }Explanation / Answer
#include int main() { int floors = 6, rooms = 20, suites = 120, occupied = 0, totalRooms = 120, totalOccupied = 0, totalUnoccupied = 0, numFloors=16; int occupRate,floor; //store hotel occupancy rate for (floor = 10; floor 20 | occupiedRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.