My TripleX bomb diffusion code so far

#include

int main()
{
// Output to terminal the scenario
std::cout << “You are a bomb diffuser who needs to diffuse a bomb before it blows everybody up”;
std::cout << std::endl;
std::cout << “You need to enter the correct codes to diffuse the bomb” << std::endl;

// Declare variables a, b and c and assign values to them
// These values can't be changed
const int CodeA = 4;
const int CodeB = 3;
const int CodeC = 2;

// Declare and assign variables with the sum and product of the previous variables
int CodeSum = CodeA + CodeB + CodeC;
int CodeProduct = CodeA * CodeB * CodeC;

// Output the sum and product
std::cout << std::endl;
std::cout << "There are 3 numbers in the code" << std::endl;
std::cout << "The codes add up to " << CodeSum << std::endl;
std::cout << "The product of the codes is " << CodeProduct << std::endl;

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

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

if (GuessSum == CodeSum && GuessProduct == CodeProduct)
{
    std::cout << "You guessed correctly! The bomb is diffused and everyone is safe!";
}
else
{
    std::cout << "You guessed wrong and the bomb went off!";
}

// End the main function
return 0;

}

1 Like

Great looking code!