-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
58 lines (53 loc) · 1.2 KB
/
Copy pathmain.cpp
File metadata and controls
58 lines (53 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include "struct.h"
#include "rooms.h"
#include "global_variables.h"
using namespace std;
bool quit()
{
cout << "are you sure? [y/n] \n";
while(true)
{
getline(cin, command);
if(command == "y")
return true;
if(command == "n")
return false;
}
}
int main()
{
string currentRoom("enter bedroom");
placeholder = currentRoom;
do
{
if(currentRoom == "enter bedroom")
{
placeholder = currentRoom;
command = "cmetr";
currentRoom = gotoBedroom();
}
if(currentRoom == "enter bathroom")
{
placeholder = currentRoom;
command = "cmetr";
currentRoom = gotoBathroom();
}
if(currentRoom == "enter hallway")
{
placeholder = currentRoom;
command = "cmetr";
currentRoom = gotoHallway();
}
if(currentRoom == "quit")
{
bool quitVar = quit();
if(quitVar)
play = false;
if(quitVar == false)
currentRoom = placeholder;
}
}
while(play);
return 0;
}