Please help me the problem is when i run the program it suppose to display your score when you lose but it tends to continue because of the statements. How can i fix this? Thankyou in advance!!
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() { int level, choice, choices, wish, l2ans1, l2ans2,
l2ans3, l2ans4, l2ans5, l2ans6; // l2ans1 = LEVEL 2 ANSWER 1 char
set, ans1, ans2, ans3, ans4, ans5; // ans1 = ANSWER 1 FOR LEVEL 1
ONLY string l3ans1, l3ans2, l3ans3, l3ans4, l3ans5, l3ans6; //
string is used because the given answer is in word. LEVEL 3 ANSWER
#. wish = 1; do { { system ("CLS"); cout << "Enter the desired choice." << endl; cout << "[1] About " << endl; cout <<
"[2] Play The Wuzzles Game " << endl; cout << "[3] Exit " << endl;
cin >> choices; } if (choices == 1) { cout << "\nAbout" <<
endl; cout << "\nThe developers of this project are Hortinela,
Doma and Galangco." << endl; cout << "Copyright 2015." << endl;
cout << "All rights reserved." << endl;
cout << endl; cout << "\nDo you wish to continue?" << endl; cout << "\n[1] YES" << endl; cout << "\n[0] NO" << endl; cin
>> wish; } else if (choices == 2) {
cout << "\nPlease choose what level do you prefer:" << endl; cout << "[1] Easy" << endl; cout << "[2] Medium" << endl; cout <<
"[3] Hard" << endl; cin >> level; if(level == 1) { cout <<
endl; cout << "\nPlease choose which number of set would you
prefer:" << endl; cout << "a. Set 1" << endl; cout << "b. Set
2" << endl; cout << "c. Set 3" << endl; cin >> set;
switch(set) {
case 'a':
case 'A':
cout << "\nWUZZLES #1" << endl;
cout << "\nLINE" << endl;
cout << "LINE" << endl;
cout << "\na. Double line" << endl;
cout << "b. Parallel line" << endl;
cout << "ANSWER: ";
cin >> ans1;
if (ans1 == 'a' || 'A')
{
cout << "\nWUZZLES #2" << endl;
cout << "\nN" << endl;
cout << " W" << endl;
cout <<" O" << endl;
cout << " D" << endl;
cout << "\na. Upside down" << endl;
cout << "b. Down stairs" << endl;
cout << "ANSWER: ";
cin >> ans2;
if (ans2 == 'b' || 'B')
{
cout << "\nWUZZLES #3" << endl;
cout << " STAND " << endl;
cout << " ---------" << endl;
cout << " EYE " << endl;
cout << "\na. Eye stand" << endl;
cout << "b. I understand" << endl;
cout << "ANSWER: ";
cin >> ans3;
if (ans3 == 'b' || 'B')
{
cout << "\nWUZZLES #4" << endl;
cout << "\nB A" << endl;
cout << " BUSH " << endl;
cout << "E T" << endl;
cout << "\na. Beat around the bush" << endl;
cout << "b. Beat the bush" << endl;
cout << "ANSWER: ";
cin >> ans4;
if (ans4 == 'a' || 'A')
{
cout << "\nWUZZLES #5" << endl;
cout << "\n BUY" << endl;
cout << "------_" << endl;
cout << " LINE" << endl;
cout << "\na. Buy in line"<< endl;
cout << "b. Buy online" << endl;
cout << "ANSWER: ";
cin >> ans5;
if (ans5 == 'b' || 'B')
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break;
case 'b':
case 'B':
cout << "\nWUZZLES #1" << endl;
cout << "\nGETHANDGET" << endl;
cout << "\na. Get out of hand" << endl;
cout << "b. To get out of hand" << endl;
cout << "ANSWER: ";
cin >> ans1;
if (ans1 == 'b' || 'B')
{
cout << "\nWUZZLES #2" << endl;
cout << "\nDANCE" << endl;
cout << "DANCE" << endl;
cout << "DANCE" << endl;
cout << "DANCE <---" << endl;
cout << "\na. 4th Dance" << endl;
cout << "b. Last dance" << endl;
cout << "ANSWER: ";
cin >> ans2;
if (ans2 == 'b' || 'B')
{
cout << "\nWUZZLES #3" << endl;
cout << "\nT T T" << endl;
cout << "I I I" << endl;
cout << "S S S" << endl;
cout << "\na.Sit ups" << endl;
cout << "b. Sit right up" << endl;
cout << "ANSWER: ";
cin >> ans3;
if (ans3 == 'a' || 'A')
{
cout << "\nWUZZLES #4" << endl;
cout << "\n J" << endl;
cout << " U" << endl;
cout << " S" << endl;
cout << " T" << endl;
cout << "\na. Just right down" << endl;
cout << "b. Just right" << endl;
cout << "ANSWER: ";
cin >> ans4;
if (ans4 == 'b' || 'B')
{
cout << "\nWUZZLES #5" << endl;
cout << "\nI FELL" << endl;
cout << "I FELL" << endl;
cout << "I FELL"<< endl;
cout << "I FELL" << endl;
cout << "\na. Eifell Tower" << endl;
cout << "b. I fell for you" << endl;
cout << "ANSWER: ";
cin >> ans5;
if (ans5 == 'a' || 'A')
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break;
case 'c':
case 'C':
cout << "\nWUZZLES #1" << endl;
cout << "\nDRESS + DRESS" << endl;
cout << "\na. Addresses" << endl;
cout << "b. Address" << endl;
cout << "ANSWER: ";
cin >> ans1;
if (ans1 == 'b' || 'B')
{
cout << "\nWUZZLES #2" << endl;
cout << "\nDIET = DIET" << endl;
cout << "\na. Equivalent diet" << endl;
cout << "b. Balanced diet" << endl;
cout << "ANSWER: ";
cin >> ans2;
if (ans2 == 'b' || 'B')
{
cout << "\nWUZZLES #3" << endl;
cout << "\nCOF/FEE" << endl;
cout << "\na. Coffee break" << endl;
cout << "b. Coffee fee" << endl;
cout << "ANSWER: ";
cin >> ans3;
if (ans3 == 'a' || 'A')
{
cout << "\nWUZZLES #4*" << endl;
cout << "\nTHERE" << endl;
cout << "THERE" << endl;
cout << "THERE" << endl;
cout << "\na. They're all the same" << endl;
cout << "b. Over there" << endl;
cout << "ANSWER: ";
cin >> ans4;
if (ans4 == 'a' || 'A')
{
cout << "\nWUZZLES #5" << endl;
cout << "\n1,2,3,..." << endl;
cout << "---------" << endl;
cout << " ME " << endl;
cout << "\na. You can count on me" << endl;
cout << "b. Count on me" << endl;
cout << "ANSWER: ";
cin >> ans5;
if (ans5 == 'b' || 'B')
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break; } } else if(level == 2) {
cout << "\nPlease choose which number of set would you prefer:" << endl;
cout << "a. Set 1" << endl;
cout << "b. Set 2" << endl;
cin >> set;
switch(set)
{
case 'a':
case 'A':
cout << "\nPLEASE ENTER THE MISSING NUMBER WHICH CORRESPONDS THE WORD" << endl;
cout << "MISSING IN THE GIVEN WUZZLE!!!" << endl;
cout << "\nWUZZLES #1" << endl;
cout << "\nABCDEF a week" << endl;
cout << "GHIJKL a week" << endl;
cout << "MNOPQR a week" << endl;
cout << "SUWXYZ a week" << endl;
cout << "No TV _ a week" << endl;
cout << "ANSWER: ";
cin >> l2ans1;
if (l2ans1 == 4)
{
cout << "\nWUZZLES #2*" << endl;
cout << "\n[3] BLAME" << endl;
cout << "[4] BLAME" << endl;
cout << "\nNo _ to blame." << endl;
cout << "ANSWER: ";
cin >> l2ans2;
if (l2ans2 == 1)
{
cout << "\nWUZZLES #3" << endl;
cout << "\nT ORDER O" << endl;
cout << "\nIn order _." << endl;
cout << "ANSWER: ";
cin >> l2ans3;
if (l2ans3 == 2)
{
cout << "\nWUZZLES #4" << endl;
cout << "\n * 1 *" << endl;
cout << " * 1 *" << endl;
cout << "LOOKING * 1 *" << endl;
cout << " * 1 *" << endl;
cout << "\nLooking out _ the number _." << endl;
cout << "ANSWER: ";
cin >> l2ans4 >> l2ans5;
if (l2ans4 == 4 && l2ans5 == 1)
{
cout << "\nWUZZLES #5" << endl;
cout << "\nBAD" << endl;
cout << "BAD" << endl;
cout << "\nThat's _ bad!" << endl;
cout << "ANSWER: ";
cin >> l2ans6;
if (l2ans6 == 2)
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break;
case 'b':
case 'B':
cout << "\nPLEASE ENTER THE MISSING NUMBER WHICH CORRESPONDS THE WORD" << endl;
cout << "MISSING IN THE GIVEN WUZZLE!!!" << endl;
cout << "\nWUZZLES #1*" << endl;
cout << " U -> NEXT" << endl;
cout << "\nRight next _ U." << endl;
cout << "ANSWER: ";
cin >> l2ans1;
if (l2ans1 == 2)
{
cout << "\nAPPLE" << endl;
cout << "APPLE" << endl;
cout << "APPLE" << endl;
cout << "\nApple _" << endl;
cout << "ANSWER: ";
cin >> l2ans2;
if (l2ans2 == 3)
{
cout << "\nWUZZLES #3" << endl;
cout << "\nMESS * 3 + TER" << endl;
cout << "\n_mester" << endl;
cout << "ANSWER: ";
cin >> l2ans3;
if (l2ans3 == 3)
{
cout << "\nWUZZLES #4" << endl;
cout << "\nGET IT" << endl;
cout << "GET IT" << endl;
cout << "GET IT" << endl;
cout << "GET IT" << endl;
cout << "\n_GET IT" << endl;
cout << "ANSWER: ";
cin >> l2ans4;
if (l2ans4 == 4)
{
cout << "\nWUZZLES #5" << endl;
cout << "\n FIVE" << endl;
cout << "\n" << endl;
cout << "\n" << endl;
cout << "\n" << endl;
cout << "High _" << endl;
cout << "ANSWER: ";
cin >> l2ans5;
if (l2ans5 == 5)
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break; } } else if(level = 3);
{
cout << "\nPlease choose which number of set would you prefer:" << endl;
cout << "a. Set 1" << endl;
cout << "b. Set 2" << endl;
cout << "c. Set 3" << endl;
cin >> set;
switch(set)
{
case 'a':
case 'A':
cout << "\nPLEASE INPUT THE ANSWER FOR THE GIVEN WUZZLE." << endl;
cout << "\nWUZZLES #1" << endl;
cout << "\nL O" << endl;
cout << " F " << endl;
cout << " A " << endl;
cout << " L " << endl;
cout << " L " << endl;
cout << "V E" << endl;
cout << "\nFall __ Love." << endl;
cout << "ANSWER: ";
cin >> l3ans1;
if (l3ans1 == "in" || "In" || "IN")
{
cout << "\nWUZZLES #2" << endl;
cout << "\nFATHER" << endl;
cout << "FATHER" << endl;
cout << "FATHER" << endl;
cout << "FATHER" << endl;
cout << "\nANSWER: ";
cin >> l3ans2;
if (l3ans2 == "forefather" || "Forefather" || "FOREFATHER")
{
cout << "\nWUZZLES #3" << endl;
cout << "\nRETRAUQ" << endl;
cout << "\nANSWER: ";
cin >> l3ans3;
if (l3ans3 == "quarterback" || "QUARTERBACK" || "Quarterback")
{
cout << "\nWUZZLES #4" << endl;
cout << "\nCAN'T DO" << endl;
cout << "CAN'T DO" << endl;
cout << "CAN'T DO" << endl;
cout << "\nNo ____ do." << endl;
cout << "\nANSWER: ";
cin >> l3ans4;
if (l3ans4 == "can" || "CAN" || "Can")
{
cout << "\nWUZZLES #5" << endl;
cout << "\nWHERE WHERE WHERE WHERE" << endl;
cout << "-----------------------" << endl;
cout << " R A I N B O W " << endl;
cout << "\n____________ over the rainbow." << endl;
cout << "\nANSWER: ";
cin >> l3ans5;
if (l3ans5 == "somewhere" || "Somewhere" || "SOMEWHERE")
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break;
case 'b':
case 'B':
cout << "\nPLEASE INPUT THE ANSWER FOR THE GIVEN WUZZLE." << endl;
cout << "\nWUZZLES #1" << endl;
cout << "\n BRIDGE" << endl;
cout << "w t r" << endl;
cout << " a e s" << endl;
cout << "\nBridge over __________ waters." << endl;
cout << "\nANSWER: ";
cin >> l3ans1;
if (l3ans1 == "troubled" || "TROUBLED" || "Troubled")
{
cout << "\nWUZZLES #2" << endl;
cout << "\nGIVE GIVE" << endl;
cout << "GIVE GIVE" << endl;
cout << "GET GET" << endl;
cout << "GET GET" << endl;
cout << "\n___________ and ___________." << endl;
cout << "\nANSWER: ";
cin >> l3ans2 >> l3ans3;
if (l3ans2 == "FORGIVE" || "Forgive" || "forgive" && l3ans3 == "FORGET" || "Forget" || "forget")
{
cout << "\nWUZZLES #3" << endl;
cout << "\nPOL4ICY" << endl;
cout << "\n_________ Policy" << endl;
cout << "\n ANSWER: ";
cin >> l3ans4;
if (l3ans4 == "FOREIGN")
{
cout << "\nWUZZLES #4" << endl;
cout << "\nTEMP" << endl;
cout << " ERA" << endl;
cout << " TURE" << endl;
cout << "\nANSWER: " << endl;
cin >> l3ans5;
if (l3ans5 == "falling" || "FALLING" || "Falling")
{
cout << "\nWUZZLES #5" << endl;
cout << "\nDEAD BODY" << endl;
cout << " MY " << endl;
cout << "\n_______ my dead body." << endl;
cout << "\nANSWER: ";
cin >> l3ans6;
if (l3ans6 == "OVER" || "Over" || "over")
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break;
case 'c':
case 'C':
cout << "\nPLEASE INPUT THE ANSWER FOR THE GIVEN WUZZLE." << endl;
cout << "\nWUZZLES #1" << endl;
cout << "\nMONKEY" << endl;
cout << " RUOY" << endl;
cout << "\nMonkey on your ______." << endl;
cout << "\nANSWER: " << endl;
cin >> l3ans1;
if (l3ans1 == "back" || "BACK" || "Back")
{
cout << "\nWUZZLES #2" << endl;
cout << "\nG" << endl;
cout << "N" << endl;
cout << "I" << endl;
cout << "K" << endl;
cout << "C" << endl;
cout << "A" << endl;
cout << "B" << endl;
cout << "\n Backing ___" << endl;
cout << "\nANSWER: ";
cin >> l3ans2;
if (l3ans2 == "UP" || "Up" || "up")
{
cout << "\nWUZZLES #3" << endl;
cout << "\nAALLLL" << endl;
cout << "\nAll ___ all" << endl;
cout << "\nANSWER: ";
cin >> l3ans3;
if (l3ans3 == "in" || "IN" || "In")
{
cout << "\nWUZZLES #4" << endl;
cout << "\ngroPOOLund" << endl;
cout << "\n__________ pool" << endl;
cout << "\nANSWER:";
cin >> l3ans4;
if (l3ans4 == "Inground" || "inground" || "Inground")
{
cout << "\nWUZZLE #5" << endl;
cout << "\nWORKING" << endl;
cout << "---------" << endl;
cout << " TIME " << endl;
cout << "\nWorking __________" << endl;
cout << "\nANSWER: ";
cin >> l3ans5;
if (l3ans5 == "overtime" || "Overtime" || "OVERTIME")
{
cout << "CONGRATULATIONS! You gained a perfect score." << endl;
}
else
{
cout << "Game over! Your total score is" << 4 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 3 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 2 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 1 << ". " << "Thank you!";
}
}
else
{
cout << "Game over! Your total score is" << 0 << ". " << "Thank you!";
}
break; }
} system("PAUSE"); return 0;
cout << endl; cout << "Do you wish to continue?" << endl; cout << "[1] YES" << endl; cout << "[0] NO" << endl; cin >>
wish;
}
else if (choices == 3) { wish = 0; } } while (wish == 1);
system("PAUSE"); //cin.get return 0; }
Aucun commentaire:
Enregistrer un commentaire