#include <iostream>
int main()
{
//Starting story
std::cout << "You work for Shadow, you need to break into Midas' Ghost headquarters...";
std::cout << std::endl;
std::cout << "Retrieve the data from- THE DOOMSDAY DEVICE. Before it's too late!" << std::endl;
//Declare 3 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 and product of 3 numbers
std::cout << std::endl;
std::cout << "+ The password into the secret files is made up of 3 numbers." << std::endl;
std::cout << "+ These numbers add up to: " << CodeSum << std::endl;
std::cout << "+ They multiply to make: " << 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 << "Well done agent, the files are being uploaded now, you've done a good job.";
}
else
{
std::cout << "Agent, you have entered the wrong code and set off the alarm system. You're fired, and in danger.";
}
return 0;
}
2 Likes