#include using namespace std; int room1(); int room2(); int main(){ int room = 1; // which room is the player in cout << "Welcome to the maze\n"; do{ if(room == 1){ room = room1(); } if(room == 2){ room2(); } }while(room != 2); cout << "You escaped.\n"; } int room1(){ int choice; cout << "This is a dim room.\n"; cout << "There's an exit (1) West.\n"; cout << "(2) Stay here.\n"; do{ cin >> choice; }while(choice < 1 || choice > 2); if(choice == 2) return 1; // go to room 2 if(choice == 1) return 2; // goto to room 2 } int room2(){ cout << "It's bright here.\n"; }