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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
int lvl2(struct Player st[],int& itemcount)
{
st[itemcount].money = st[itemcount].total;
st[itemcount].wheelval = 0; st[itemcount].total = 0;
system("cls");
cout << "Hello again, " << st[itemcount].name << ". Are you ready for the next level? \nYou start the game with $" << st[itemcount].money << "." << endl;
wait(seconds);
int seconds = 1, wrong = 0, choice;
wait(seconds);
vector< string > dictionary2;
getDictionary2( dictionary2 );
int randomWord2;
randomWord2 = rand() % dictionary2.size();
string word2 = dictionary2[ randomWord2 ];
char key = ' ',key2 = ' ', key3=' ', lvl;
locale loc2;
string copy2 = word2;
string Underscore2, guess2;
for(int i=0; i!=word2.length(); i++){
if(word2.at(i) == ' '){
Underscore2 += " ";
} else{
Underscore2 += "-";
}
}
// string usedLetter = "";
while(1){
// spin:
wait(seconds);
system("cls");
cout << "PRESS ANY KEY TO SPIN" << endl;
allwheel();
spin(st, itemcount);
wait(seconds);
// for (string::size_type i=0; i<usedLetter.length(); ++i)
// usedLetter = toupper(usedLetter[i],loc);
// cout << "\nYou've used this letters: " << usedLetter << endl;
// system("cls");
st[itemcount].total = st[itemcount].wheelval + st[itemcount].money;
st[itemcount].money = st[itemcount].total;
st[itemcount].wheelval = 0;
back:
again:
cout << endl;
cout << endl << Underscore2 << endl << endl;
cout << "The Category of the Word is TITLE OF MOVIES." << endl;
cout << "There are " << word2.length() << " letters and spaces" << endl;
cout << "You have " << 7 - wrong << " more tries left" << endl;
cout << "You currently have $" << st[itemcount].total << endl;
cout << "Guess a consonant letter or Solve the word" << endl;
getline(cin,guess2);
cin.ignore(256, '\n');
// for (string::size_type i=0; i<guess.length(); ++i)
// guess = toupper(guess[i],loc);
if(guess2.length() > 1){
if(guess2 == word2){
cout << "Congratulations, you guessed the word! +$7000" << endl;
st[itemcount].total = st[itemcount].total + 7000;
cout << "Proceed to the next level?(y/n)";
cin >> lvl;
if(lvl == 'y' || lvl == 'Y'){
lvl2(st,itemcount);
}else
cout << "You've earned $" << st[itemcount].total << endl;
exit(1);
}else{
cout << "Wrong word " << endl;
wrong++;
}
}
if(guess2 == "A" ||guess2 == "E" ||guess2 == "I" ||guess2 == "O" ||guess2 == "U")
{
cout << "Invalid Letter, you need to buy the Vowel\n";
wait(seconds);
goto again;
}
// else if(! checkLetter(key,guess,word))
// {
// cout << "You've already guessed this letter!";
// }
else if(copy2.find(guess2) != -1){
cout << endl << "Correct letter!" << endl;
while(copy2.find(guess2) != -1){
Underscore2.replace(copy2.find(guess2), 1, guess2);
copy2.replace(copy2.find(guess2), 1, "_");
if(Underscore2 == word2){
cout << "Congratulations, you guessed the word! +$7000" << endl;
st[itemcount].total = st[itemcount].total + 7000;
cout << "Proceed to the next level?(y/n)";
cin >> lvl;
if(lvl == 'y' || lvl == 'Y'){
lvl2(st,itemcount);
}else
cout << "You've earned $" << st[itemcount].total << endl;
exit(1);
}
loop:
cout << Underscore2 << endl;
wait(seconds);
cout << "You currently have $" << st[itemcount].total << endl;
st[itemcount].money = st[itemcount].total;
cout << "Buy a Vowel-$450ea(V), Spin(space), or Solve(S)" << endl;
key2 = _getch();
switch(key2){
case 'V': case 'v':{
if(st[itemcount].total<450){
cout << "You have Insufficient Money." << endl;
goto back;
}
buy:
cout << "What vowel do you want to buy?" << endl << "A E I O U" << endl;
key3 = _getch();
switch (key3){
case 'A': case 'a':{
guess2 = 'A';
st[itemcount].total = st[itemcount].total - 450;
if(copy2.find(guess2) != -1){
while(copy2.find(guess2) != -1){
Underscore2.replace(copy2.find(guess2), 1, guess2);
copy2.replace(copy2.find(guess2), 1, "_");
goto loop;
}
}
break;
}
case 'E': case 'e':{
guess2 = 'E';
st[itemcount].total = st[itemcount].total - 450;
if(copy2.find(guess2) != -1){
while(copy2.find(guess2) != -1){
Underscore2.replace(copy2.find(guess2), 1, guess2);
copy2.replace(copy2.find(guess2), 1, "_");
goto loop;
}
}
break;
}
case 'I': case 'i':{
guess2 = 'I';
st[itemcount].total = st[itemcount].total - 450;
if(copy2.find(guess2) != -1){
while(copy2.find(guess2) != -1){
Underscore2.replace(copy2.find(guess2), 1, guess2);
copy2.replace(copy2.find(guess2), 1, "_");
goto loop;
}
}
break;
}
case 'O': case 'o':{
guess2 = 'O';
st[itemcount].total = st[itemcount].total - 450;
if(copy2.find(guess2) != -1){
while(copy2.find(guess2) != -1){
Underscore2.replace(copy2.find(guess2), 1, guess2);
copy2.replace(copy2.find(guess2), 1, "_");
goto loop;
}
}
break;
}
case 'U': case 'u':{
guess2 = 'U';
st[itemcount].total = st[itemcount].total - 450;
if(copy2.find(guess2) != -1){
while(copy2.find(guess2) != -1){
Underscore2.replace(copy2.find(guess2), 1, guess2);
copy2.replace(copy2.find(guess2), 1, "_");
goto loop;
}
}
break;
}default: cout << "Invalid Input, only Vowel" << endl;
goto buy;
}
break;
}
case ' ':{
//goto spin;
break;
}
case 'S': case 's':{
cout << "Solve it " << endl;
getline(cin, guess2);
if(guess2 == word2){
cout << "Congratulations, you guessed the word! +$7000" << endl;
st[itemcount].total = st[itemcount].total + 7000;
cout << "Proceed to the next level?(y/n)";
cin >> lvl;
if(lvl == 'y' || lvl == 'Y'){
lvl2(st,itemcount);
}else
cout << "You've earned $" << st[itemcount].total << endl;
exit(1);
} else{
cout << "Wrong word " << endl;
wrong++;
}
break;
}
default:
cout << "Invalid Input, only (V),(space), or (S)" << endl;
goto loop;
}
}
}
else{
cout << guess2 << " is an incorrect word/letter." << endl;
int seconds = 2;
wait(seconds);
wrong++;
}if(wrong == 7){
cout << "You Lose! The word was: " << word2 << endl;
system("pause");
break;
}
}
}
|