/*
* Storyline: You have been locked into schools wardrobe by some bullies and the've protected the lock
* with a digital security system.
* You need to get free since the school is about to start, so HURRY UP!
*/
#include <iostream>
int main()
{
//print welcome messages to the terminal
std::cout << "School starts. You've been locked into a locker by bullies and need to brake the SkynetDigitalLock (tm) to exit";
std::cout << std::endl;
std::cout << "You need to enter the correct codes to continue..." << std::endl;
//declare our three number code
const int CodeA = 4;
const int CodeB = 3;
const int CodeC = 2;
const int CodeSum = CodeA + CodeB + CodeC;
const int CodeProduct = CodeA * CodeB * CodeC;
//print sum an product to the terminal
std::cout << std::endl;
std::cout << "* there are 3 numbers in the code" << std::endl;
std::cout << "* The code adds up to: " << CodeSum << std::endl;
std::cout << "* The product of the code numbers is: " << CodeProduct << std::endl;
int GuessA, GuessB, GuessC;
std::cin >> GuessA;
std::cin >> GuessB;
std::cin >> GuessC;
std::cout << std::endl;
const int GuessSum = GuessA + GuessB + GuessC;
const int GuessProduct = GuessA * GuessB * GuessC;
if (GuessSum == CodeSum && GuessProduct == CodeProduct)
{
std::cout << "*** You've opened the locker secretly and made it to class in time ! ***";
}
else
{
std::cout << "*** You failed to open the locker before class starts. You're still locked in! ***" << std::endl;
std::cout << "*** Since it is friday, you are going to stay in the locker for the whole weekend! ***";
}
return 0;
}
That’s a nice story!