Win and lose code

#include <iostream>

int main()
{
    int PasswordCodeA{ 4 }, PasswordCodeB{ 3 }, PasswordCodeC{ 8 };
    int PasswordCodeSum{ PasswordCodeA + PasswordCodeB + PasswordCodeC };
    int PasswordCodeMultiplication{ PasswordCodeA * PasswordCodeB * PasswordCodeC };

    int GuessA{}, GuessB{}, GuessC{};
    int GuessSum{}, GuessMultiplication{};

    std::cout << "You are now a Treasure Hunter try to get the precious treasure" << std::endl;
    std::cout << "To get the treasure you need to input the correct password" << std::endl;

    std::cout << std::endl;
    std::cout << "There are 3 numbers in the password code" << std::endl;
    std::cout << "The password codes add-up to: " << PasswordCodeSum << std::endl;
    std::cout << "The password codes mutiply to give: " << PasswordCodeMultiplication << std::endl;

    std::cout << std::endl;
    std::cout << "Please enter your guess password codes: ";
    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;

    GuessSum = GuessA + GuessB + GuessC;
    GuessMultiplication = GuessA * GuessB * GuessC;

    if (GuessSum == PasswordCodeSum && GuessMultiplication == PasswordCodeMultiplication)
    {
        std::cout << "You have an Acient Precious Treasure!" << std::endl;
    }
    else
    {
        std::cout << "The treasure has been seal for another 100 years!" << std::endl;
    }

    return 0;
}#include <iostream>

int main()
{
    int PasswordCodeA{ 4 }, PasswordCodeB{ 3 }, PasswordCodeC{ 8 };
    int PasswordCodeSum{ PasswordCodeA + PasswordCodeB + PasswordCodeC };
    int PasswordCodeMultiplication{ PasswordCodeA * PasswordCodeB * PasswordCodeC };

    int GuessA{}, GuessB{}, GuessC{};
    int GuessSum{}, GuessMultiplication{};

    std::cout << "You are now a Treasure Hunter try to get the precious treasure" << std::endl;
    std::cout << "To get the treasure you need to input the correct password" << std::endl;

    std::cout << std::endl;
    std::cout << "There are 3 numbers in the password code" << std::endl;
    std::cout << "The password codes add-up to: " << PasswordCodeSum << std::endl;
    std::cout << "The password codes mutiply to give: " << PasswordCodeMultiplication << std::endl;

    std::cout << std::endl;
    std::cout << "Please enter your guess password codes: ";
    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;

    GuessSum = GuessA + GuessB + GuessC;
    GuessMultiplication = GuessA * GuessB * GuessC;

    if (GuessSum == PasswordCodeSum && GuessMultiplication == PasswordCodeMultiplication)
    {
        std::cout << "You have an Acient Precious Treasure!" << std::endl;
    }
    else
    {
        std::cout << "The treasure has been seal for another 100 years!" << std::endl;
    }

    return 0;
}

Winning screen

Losing screen

1 Like

Awesome job! :+1:

Privacy & Terms