Odpowiedź :
#include <iostream>
#include <string>
using namespace std;
int main(){
hotel:
string hotel_name;
int number_of_floors=0;
int floor_without_rooms=0;
int rooms_number=0;
int rooms_busy_number=0;
cout <<"Hello in this awesome program" << endl;
cout << "What's the hotel's name: ";
cin >> hotel_name;
cout << "\n What's the number of floors: ";
cin >> number_of_floors;
if(number_of_floors<1){return -1;}
cout << "\n What's the floor without rooms: ";
cin >> floor_without_rooms;
int temp = 0;
for(int i=1; i<number_of_floors; i++){
cout << "Floor["+to_string(i)+"] | Number of rooms: ";
cin >> temp;
if(temp<10){
continue;
}
rooms_number+=temp;
temp = 0;
cout << "\nFloor["+to_string(i)+"] | Number of Busy rooms: ";
cin >> temp;
rooms_busy_number+=temp;
cout << endl;
}
cout << "\nHotel's name: "+hotel_name << endl;
cout << "Number of rooms: "+to_string(rooms_number) << endl;
cout << "Number of busy rooms: "+to_string(rooms_busy_number) << endl;
cout << "Number of free rooms: "+to_string(rooms_number-rooms_busy_number) << endl;
cout << "Percentage of busy rooms: "+to_string(100*rooms_busy_number/rooms_number) << endl;
string choice = "";
choice:
cout << "Do you want to try again with another hotel (y/n): ";
cin >> choice;
int c = -1;
if (choice=="y"){c = 0;}
if (choice=="n"){c = 1;}
switch(c){
case 0:
goto hotel;
break;
case 1:
break;
default:
goto choice;
break;
}
return 0;
}