#include <iostream>
int main()
{
std::cout << "You have been locked in a prison cell for your crimes";
std::cout << std:: endl;
std::cout << std:: endl;
std::cout << "You need to enter in the correct codes to break out!..";
// Printing out text onto the terminal
const int CodeA = 4;
const int CodeB = 3;
const int CodeC = 2;
// Declaring the variables
const int CodeSum = CodeA + CodeB + CodeC;
const int CodeProduct = CodeA * CodeB * CodeC;
// Declaring the variables
std::cout << std:: endl;
std::cout << "Hints : " << 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 codes multiply to give: " << CodeProduct << std:: endl;
// Print the sum and the product
int GuessA, GuessB, GuessC;
std::cin >> GuessA;
std::cin >> GuessB;
std::cin >> GuessC;
const int GuessSum = GuessA + GuessB + GuessC;
const int GuessProduct = GuessA * GuessB * GuessC;
if (GuessSum == CodeSum && GuessProduct == CodeProduct)
{
std::cout << "You opened the door and escaped!";
}
else
{
std::cout << "You've entered the wrong code and the guards have caught you!";
}
return 0;
}
Iām extremely proud, hopefully this will become a big hobby of mine!