-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
61 lines (51 loc) · 1.11 KB
/
main.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
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <fstream>
#include <ctime>
#include <cstdlib>
// #include "main.hpp"
#include "header_print.hpp"
#include "draw_word.hpp"
#include "hanged.hpp"
#include "win.hpp"
#include "print_wrong_guesses.hpp"
#include "print_secret_word.hpp"
#include "guess.hpp"
#include "add_new_word.hpp"
//#include "have_letter.hpp"
//#include "read_file.hpp"
//#include "save_file.hpp"
using namespace std;
string secret_word;
map<char, bool> tried;
vector<char> wrong_guesses;
int main()
{
header_print();
draw_word();
while(!hanged() && !win())
{
print_wrong_guesses();
print_secret_word();
guess();
}
cout << "End game!\n";
cout << "The Secret Word was " << secret_word << "!\n";
if(!win())
{
cout << "You lost! Try again!\n";
}
else
{
cout << "Congratulations! You got right the Secret Word!\n";
cout << "Do you want to add a new word? (Y/N)\n";
char answer;
cin >> answer;
if(answer == 'Y')
{
add_new_word();
}
}
}