Triplex Lets open exploding treasure chests

#include <iostream>

int main()
{
    //Print welcome messages to terminal
    std::cout << "Welcome to the Dugeon of treasure chests.";
    std::cout << std::endl;
    std::cout << "You must enter the correct numbers of this 3 digit lock to get into this treasure chest.";
    std::cout << std::endl;
    std::cout << "Once correct you may enter the next room and open another treasure chest...." << std::endl;
    
    //declare 3 number code
    const int DigitA = 4;
    const int DigitB = 5;
    const int DigitC = 6;

    const int CodeSum = DigitA + DigitB + DigitC;
    const int CodeProduct = DigitA * DigitB * DigitC;

    // Print CodeSum and CodeProduct to terminal
    std::cout << std::endl;
    std::cout << "+ There are 3 numbers to unlock the chest" << std::endl;
    std::cout << "+ The codes add-up to: " << CodeSum << std::endl;
    std::cout << "+ The codes multiply to give: " << CodeProduct << std::endl;

    //Get Guesses from Player
    int GuessA, GuessB, GuessC;
    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;

    int GuessSum = GuessA + GuessB + GuessC;
    int GuessProduct = GuessA * GuessB * GuessC;

    if (GuessSum == CodeSum && GuessProduct == CodeProduct) 
    {
        std:: cout << "You got it right! The chest opens and you get a legendary sword, you may pass to the next room."<< std::endl;
    }

    else 
    {
        std::cout << "You got it wrong! the Chest exploded." << std::endl;
    }
    
    return 0;
}

Privacy & Terms