-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasicGame.cpp
48 lines (42 loc) · 1.23 KB
/
basicGame.cpp
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
#include <iostream>
#include <string>
#include "printer.hpp"
std::string getInput(){
std::string givenInput;
std::getline(std::cin, givenInput);
return givenInput;
}
std::string getHelp() {
std::string helper = "type in 'exit' to exit at any time. type in 'help' for help. type in 'look around' to get a description of where you are.";
return helper;
}
std::string getLocation(std::string location){
std::string prompt;
if (location == "home"){
prompt = "You're standing outside of a cabin. The rain is only getting heavier.";
} else {
prompt = "I don't know where you are.";
}
return prompt;
}
void printTitleScreen(){
printTitle();
std::cout << "type in 'exit' to exit at any time. type in 'help' for help. type in 'look around' to get a description of where you are." << std::endl;
printLine();
}
int main() {
std::string userInput;
printTitleScreen();
std::string location = "home";
while (userInput != "exit") {
if (userInput == "look around"){
std::cout << getLocation(location) << std::endl;
} else if (userInput == "help"){
std::cout << getHelp() << std::endl;
} else {
std::cout << "It's raining." << std::endl;
}
userInput = getInput();
}
return 0;
}