#include <iostream>
void PrintIntroduction()
{
//Print welcome messages to the terminal
std::cout << "You have to get out of this building! You'll need to find the codes on each floor to operate the elevator.";
std::cout << "\nGet to the chopper on the roof to escape!";
std::cout << "\n---------------+---------------";
std::cout << "\n ___ /^^[___ _";
std::cout << "\n /|^+----+ |#___________//";
std::cout << "\n ( -+ |____| ______-----+/";
std::cout << "\n ==_________--' ";
std::cout << "\n ~_|___|__";
}
void PlayGame()
{
PrintIntroduction();
// Declare 3 number code
const int CodeA = 4;
const int CodeB = 3;
const int CodeC = 5;
const int CodeSum = CodeA + CodeB + CodeC;
const int CodeProduct = CodeA * CodeB * CodeC;
//Print CodeSum and CodeProduct to the terminal
std::cout << std::endl;
std::cout << "\n+ There are 3 numbers in the code";
std::cout << "\n+ The numbers in the code add up to: " << CodeSum;
std::cout << "\n+ The numbers in the code multiply to give: " << CodeProduct;
// Store player guess
int GuessA, GuessB, GuessC;
std::cout << "\nEnter the code here. Use a space between each number of the code: ";
std::cin >> GuessA >> GuessB >> GuessC;
int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
//Check if the player's guess is correct
if(GuessSum == CodeSum && GuessProduct == CodeProduct)
{
std::cout << "\nCongratulations! You made it to the roof! You successfully escape in the helicopter.";
}
else
{
std::cout << "\nFailure! You entered the wrong code! The building goes into lockdown and you are captured.";
}
}
int main()
{
PlayGame();
return 0;
}
1 Like
Get to the choppa!! I love how you made a helicopter with ASCII.