This is my version of triplex... so far

This is what I’ve done so far for my TripleX game.

// This is the story of my game.

    std::cout << "You have awoken from a coma in a fancy spaceship that is about to collide into a planet you are unfamilar with.";

    std::cout << std::endl;

    std::cout << "You have to get a parashute, but first you must get through 6 layers of security, by bypassing the locks using the keypad";

   

    // This is a set of number variables I will use.

    const int CodeA = 4;

    const int CodeB = 6;

    const int CodeC = 20;

    // This does the calculation and provides an answer.

    const int CodeSum = CodeA + CodeB + CodeC;

    const int CodeProduct = CodeA * CodeB * CodeC;

    std::cout << std::endl;

    std::cout << "There are 3 numbers in the code." << std::endl;

    std::cout << "The numbers add up to: " << CodeSum << std::endl;

    std::cout << "The numbers multiply to: " << CodeProduct << std::endl;

    int playerGuess;

    int GuessA, GuessB, GuessC;

    std::cin >> GuessA;

    std::cin >> GuessB;

    std::cin >> GuessC;

    std::cout << "You guessed: " << GuessA << GuessB << GuessC;

    int GuessSum;

    int GuessProduct;

    GuessSum = GuessA + GuessB + GuessC;

    GuessProduct = GuessA * GuessB * GuessC;

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

    {

        std::cout << "You Win!";

    }

    else{

        std::cout << "You lose!";

    }

Privacy & Terms