Code so far TripleX

#include <iostream>

int main()
{
    // Print story text to terminal
    std::cout << "Ughh, they have satellite TV... haven't they ever heard of Netflix?" << std::endl;
    std::cout << "I need to find a channel with something interesting, but there are hundreds of channels..." << std::endl;

    const int ChannelN1 = 2;
    const int ChannelN2 = 5;
    const int ChannelN3 = 7;

    const int ChannelSum = ChannelN1+ChannelN2+ChannelN3;
    const int ChannelProduct = ChannelN1*ChannelN2*ChannelN3;

    // Print sum and product to terminal
    std::cout << std::endl << "I seem to recall that all the good channels consist of 3 numbers" << std::endl;
    std::cout << "What's this? A note under the remote...\n" << "It says a fantastic channel's numbers added together are " << ChannelSum << std::endl;
    std::cout << "and when multiplied together become " << ChannelProduct << std::endl << "Maybe this will get me something good to watch!" << std::endl;

    int ChannelGuessN1, ChannelGuessN2, ChannelGuessN3;
    std::cout << std::endl << "Hopefully I can solve this riddle correctly by pressing each of the three remote number buttons one at a time:\n";
    std::cin >> ChannelGuessN1 >> ChannelGuessN2 >> ChannelGuessN3;

    int ChannelGuessSum = ChannelGuessN1+ChannelGuessN2+ChannelGuessN3;
    int ChannelGuessProduct = ChannelGuessN1*ChannelGuessN2*ChannelGuessN3;

    if (ChannelGuessSum == ChannelSum && ChannelGuessProduct == ChannelProduct)
    {
        std::cout << "YES! This is my favorite show!";
    }
    else
    {
        std::cout << "No, I must have guessed the wrong channel... this is just a boring infomercial :(";
    }
    
    return 0;
}
1 Like

TripleX has never looked so good!

Privacy & Terms