TripleX code update

#include <iostream>

int main()
{
    //Here, we're setting up beginning of quest, with variables assigned to the password
    std::cout << "Welcome to the Thunderdome.  Only verified personel allowed.";
    std::cout << std::endl;
    std::cout << "What's the password?";
    std::cout << std::endl;
    std::cout << std::endl;

    const int CodeA = 4;
    const int CodeB = 7;
    const int CodeC = 3;

    /*
    
    */

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

    std::cout << "There are 3 numbers in the code" << std::endl;
    std::cout << "The codes add up to: " << CodeSum << std::endl;
    std::cout << "The codes multiply to: " << CodeProduct << std::endl;

    int GuessA, GuessB, GuessC;

    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;
    std::cout << std::endl;

    const int GuessSum = GuessA + GuessB + GuessC;

    const int GuessProduct = GuessA * GuessB * GuessC;
    
    if (GuessSum == CodeSum && GuessProduct == CodeProduct){
        std::cout << "Your guess of " << GuessA << GuessB << GuessC << " was correct.  You may enter." << std::endl;
    }
    else {
        std::cout << "Your guess of " << GuessA << GuessB << GuessC << " was incorrect.  Leave." << std::endl;
    }

    // std::cout << "The sum of your guess equals: " << GuessSum << std::endl;
    // std::cout << "The product of your guess equals: " << GuessProduct << std::endl;

    return 0; 
}

image

Privacy & Terms