-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameD.cpp
More file actions
144 lines (100 loc) · 3.61 KB
/
GameD.cpp
File metadata and controls
144 lines (100 loc) · 3.61 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#include <iostream>
#include <string>
#include <ctime>
using std::cout;
using std::cin;
using std::string;
using std::endl;
void Inicio(int Dificuldade, string Nome) {
if (Dificuldade == 1) {
cout << endl;
cout << Nome << " voce tem uma missao muito importante hoje!\n";
cout << "voce ira invadir o banco de dados de um grupo terrorista e impedir seus planos!\n";
cout << "-------------------------------------------------------------cd-----------------";
}
cout << "\nEntre o codigo correto pra adentrar o servidor:" << endl;
cout << "\nNivel atual: " << Dificuldade << endl;
}
bool GameD(int LevelDif, int Modo){
//"const" � usado para impedir o alteramento do valor dentro das variaveis.
//endl � usado para gerar um quebra de linha, semelhante com o "\n"
cout << endl;
int SenhaA = rand() % LevelDif+1*Modo, SenhaB = rand() % LevelDif+1 * Modo, SenhaC = rand() % LevelDif+1 * Modo;
int Soma = SenhaA + SenhaB + SenhaC;
int Produto = SenhaA * SenhaB * SenhaC;
cout << "Tem 3 numeros nessa senha!\n";
cout << "A soma dos tres valores e: " << Soma << endl;
cout << "A muliplicacao dos tres valores e: " << Produto << endl;
int PalpiteProduto, PalpiteSoma;
int PalpiteA, PalpiteB, PalpiteC;
bool Vitoria = true;
while (Vitoria) {
//Coletar o palpite do jogador
cout << "\nDigite a senha: ";
cin >> PalpiteA >> PalpiteB >> PalpiteC;
cout << endl;
PalpiteProduto = PalpiteA * PalpiteB * PalpiteC;
PalpiteSoma = PalpiteA + PalpiteB + PalpiteC;
cout << "Soma: " << PalpiteSoma << " / Multiplicacao: " << PalpiteProduto << endl;
cin.clear(); //limpa erros
cin.ignore(); //discarta dos buffer
if (PalpiteSoma == Soma && PalpiteProduto == Produto) {
cout << "voce passou!" << endl;
Vitoria = false;
return true;
}
else {
cout << "Senha errada! Tente novamente! Preste atencao." << endl;
}
}
return false;
system("pause > nul");
}
int main() {
int LevelDificuldade = 1, FaseSecreta = 1;
int Dif = 10;
bool FaseBonus;
string NomeORIGEM, Resposta;
cout << "ola agente, informe seu nick: ";
cin >> NomeORIGEM;
srand(time(NULL));
for (LevelDificuldade = 1; LevelDificuldade <= Dif; ) {
Inicio(LevelDificuldade, NomeORIGEM);
bool FaseCom = GameD(LevelDificuldade, FaseSecreta);
if (FaseCom == true) {
++LevelDificuldade;
}
system("cls");
if (LevelDificuldade == 11) {
cout << "Voce tem a chance de entrar em uma fase bonus, aceita?" << endl;
cin >> Resposta;
if (Resposta == "Sim" || Resposta == "ss" || Resposta == "s" || Resposta == "SIM" || Resposta == "sim") {
Dif = 15;
FaseBonus = true;
FaseSecreta = 2;
}
else if (Resposta == "Nao" || Resposta == "n�o" || Resposta == "n" || Resposta == "NAO" || Resposta == "nao") {
cout << "Putz, que pena que voce nao quer.";
FaseBonus = false;
}
}
}
if (FaseBonus == false) {
cout << "\nCaramba... Voce conseguiu! \n";
cout << "Conseguimos parar os planos do inimigo por ter voce conosco!" << endl;
cout << "Parabens agente " << NomeORIGEM << "!" << endl;
}
else if (FaseBonus == true) {
cout << "Caramba... Voce conseguiu! \n";
cout << "...?" << endl;
cout << "O que e esse teu olhar pra mim " << NomeORIGEM << "?" << endl;
cout << endl;
cout << "--Bip BIIP! Cambio " << NomeORIGEM << ", voce finalmente acordou!" << endl;
cout << NomeORIGEM << ": O que ta acontecendo? aonde estou?" << endl;
cout << "--BIIIp! Voce acabou de sair do prompt! um lugar bem escuro, certo? HAHA!" << endl;
cout << endl;
cout << " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" << endl;
cout << "\n AAAAAAAAAAAAAH!";
}
return 0;
}