TripleX game after learning if/else statement

Hmmm… I am now seeing the direction of the story.
My TripleX game would be about stealing the math exam but was blocked by a computer with a funny personality. :blush:
I added a timed delay for comedic purposes.

#include <iostream>

int main() 
{
    // Print the story message to the terminal
    std::cout << "You are a student breaking into your math teacher's office..." << std::endl; 
    std::cout << "You are to steal the exam because this is your last chance to pass..." << std::endl; 
    std::cout << "But sheesh! The files are encrypted..." << std::endl; 
    std::cout << "You need to enter the correct codes before lunch time ends..." << std::endl;
    _sleep(7000);

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

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

    //Print sum and product to the terminal
    std::cout << std::endl;  
    std::cout << "'Riddle Riddle Riddle...', the computer starts to say." << std::endl; 
    std::cout << "'Three numbers for you to handle.'" << std::endl; 
    std::cout << "'The codes add-up to " << CodeSum << "'" << std::endl; 
    std::cout << "'Multiplied to give " << CodeProduct << "'" << std::endl; 
    std::cout << "'What numbers would it be?'" << std::endl;  
    std::cout << std::endl; _sleep(5000);
    
    //Player enters the code
    std::cout << "'Enter the Code: ";
    int GuessA, GuessB, GuessC;
    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;
    std::cout << std::endl;
    

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

    if (GuessSum==CodeSum && GuessProduct==CodeProduct)
    {
        _sleep(500);
        std::cout << "'Heeey, right choice~'" << std::endl;
        _sleep(2000);
        std::cout << "'Bummer~'" << std::endl;
        _sleep(1500);
    }
    else
    {
        _sleep(500);
        std::cout << "'You suck at these, do you?', the computer responded with dismay..." << std::endl;
        _sleep(1500);
        std::cout << "And exploded at your face." << std::endl;
        _sleep(1500);
    }
    

    return 0; 
}

Privacy & Terms