Are you the chosen one? (Extended)

#include <iostream>
int main()
{
    std::cout << "Are you the chosen one..."; 
    std::cout << std::endl;
    std::cout << "Solve the following puzzle to prove you are the chosen on..." << std::endl;
    
    const int CodeA = 5; 
    const int CodeB = 2;
    const int CodeC = 4;

    const int CodeSum = CodeA + CodeB + CodeC; 

    const int CodeProduct = CodeA * CodeB * CodeC; 

    std::cout << std::endl;
    std::cout <<"Your clues are..." << std::endl;
    std::cout << "The numbers add-up to..." << CodeSum << std::endl; // print sum
    std::cout << "The numbers multiply to give..." << CodeProduct << std::endl; // print product

    int GuessA, GuessB, GuessC;
    
    int GuessSum, GuessProduct;

    std::cin >> GuessA;
    std::cin >> GuessB;
    std::cin >> GuessC;

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

    if (GuessSum == CodeSum && GuessProduct == CodeProduct)
    {
        std::cout <<"You are the chosen one.";
    }
    else
    {
        std::cout <<"You are not the chosen one. You shall perish now. ";
    }
    

    return 0;
}

Screenshot 2021-08-14 124651

1 Like

I am the chosen one.

1 Like

Privacy & Terms