Mario Is Missing Part 2! So far

#include <iostream>

int main()
{
    // Beginning of the story and game explanation
    std::cout << "Bowser has taken Mario captive!";
    std::cout << std::endl;
    std::cout << "It is once again up to you, Luigi, to save your brother.";
    std::cout << std::endl;
    std::cout << "You must beat Bowser in a game of number riddles!";
    std::cout << std::endl;

    // Declare 3 number code
    const int CodeA = 5;
    const int CodeB = 2;
    const int CodeC = 6;

    // Compute sum of codes
    const int CodeSum = CodeA + CodeB + CodeC;

    // Compute product of codes
    const int CodeProduct = CodeA * CodeB * CodeC;


    // Print to console
    std::cout << std::endl;
    std::cout << "- There are 3 numbers you must guess" << std::endl;
    std::cout << "- The numbers add up to: " << CodeSum << std::endl;
    std::cout << "- When multiplied the numbers equal: " << CodeProduct << std::endl;

    std::cout << "Enter your guesses: ";

    // Declare 3 number guesses
    int GuessA, GuessB, GuessC;

    // Player input
    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;

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

    std::cout << std::endl;

    if((GuessSum == CodeSum) && (GuessProduct == CodeProduct))
    {
        std::cout << "You're Winner!";
    }
    else
    {
        std::cout << "Oh no! Mario has been lost forever...";
    }

    return 0;
}

Console:
image

“You’re winner” is intentional. It comes from the win screen for Big Rigs: Over the Road Racing

1 Like

Privacy & Terms