Current TripleX code

#include

#include

using namespace std;

int main()

{

//Variables

//-Correct Codes-

int CodeA = 4; int CodeB = 2; int CodeC = 8;

//Code Hints

int CodeSum = CodeA + CodeB + CodeC; int CodeProduct = CodeA * CodeB * CodeC;



//Guesses

int GuessA, GuessB, GuessC;



//Misc

int Lives = 3;

string EnterGuess = "Enter your guess one digit at a time:";

string Breath = "You also gained a little breathing room giving you more time to make a guess";

string Fail = "You failed to secape and was caught, never to be seen again.";

string Wrong = "You got it wrong, hurry you have time enough for ";

int RoomNumber = 1;

bool Escaped = false;

//Intro to Triplex

cout << "You have been kidnapped!\n" << endl;



//To be ran until you escape (will change later)

while(Escaped != true && Lives != 0)

{

    cout << "You must open all the locks to escape!\n" << endl;



    cout << "Each lock consists of three numbers" << endl;

    cout << "Hint 1: All three numbers total up to: " << CodeSum << endl;

    cout << "Hint 2: The code when multiplied together equals: " << CodeProduct << endl;

    cout << endl;

      cout << "Enter your guess" << endl;

//Insert Guesses (one digit at a time)

cout << EnterGuess << endl;

cin >> GuessA;

cin >> GuessB;

cin >> GuessC;

int GuessSum = GuessA + GuessB + GuessC;

int GuessProduct = GuessA * GuessB * GuessC;

    if(RoomNumber == 1)

    {

        if(GuessSum == CodeSum && GuessProduct == CodeProduct)

        {

            cout << "You are correct, you escaped the " << RoomNumber << "st room." << endl;

            RoomNumber ++;

            cout << Breath << endl;

        }else

        {

            Lives--;

            if(Lives > 0)

            {

                cout << Wrong << Lives << " more guesses!" << endl;

            }else

            {

                cout << Fail << endl;

            }

        }

        

    }else

    {

        if(GuessSum == CodeSum && GuessProduct == CodeProduct)

        {

            cout << "You escaped room " << RoomNumber << endl;

            RoomNumber++;

        }else

        {

            Lives--;

            if(Lives > 0)

            {

                cout << Wrong << Lives << " more guesses!" << endl;

            }else

            {

                cout << Fail << endl;

            }

        }

    }

}

return 0;

}

it looks better in the compiler

Privacy & Terms