#include // prerequisite code imported for it’s functionality
// i.e. it's ability to facilitate certain tasks within a program.
// This programe is using UpperCamelCase for variable declarations this is in accordance with Unreal Engine’s naming convention.
int main()
{
/*
These top statements provide the welcome outputs and ask for the relevant input. Could be
thought of as the input section.
*/
std::cout << "You are on a quest to find all Seven of the 'Chrystals of Creation'";
std::cout << std::endl;
std::cout << "Welcome, Seeker"<< std::endl;
std::cout << "To release the next crystal from 'The Vault of Testing' enter the correct 3 digit code.";
std::cout << std::endl;
/*
The section below consists of declaration statements that allow us to provide (either directly
or by input from oustide source) values for the program to work on.
*/
int CodeA = 5;// This area is composed of declaration statements.
int CodeB = 6;
int CodeC = 7;
int CodeSum = CodeA + CodeB + CodeC;
int CodeProduct = CodeA * CodeB * CodeC;// declarations down as far as here.
/*
Finally, below, the statements to provide the final output are written.
*/
std::cout << std::endl;// Expression statements. The..."do something" instructions.
std::cout << "The code consists of 3 numbers between 0 and 9" <<std::endl;
std::cout << "The numbers within the code adds up to: "<< CodeSum << std::endl;// All statements, of any kind end with ';'
std::cout << "When multiplied together the numbers give a total of: "<< CodeProduct << std::endl;
int GuessA, GuessB, GuessC;
std::cout << "What is the code, Seeker?"<< std::endl;
std::cin >> GuessA;
std::cin >> GuessB;
std::cin >> GuessC;
//std::cout << "So...: " << GuessA << GuessB << GuessC;
//std::cout << " you say, hmmm?" << std::endl;
int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
/* A C++ IF statement is needed to sort correct answers from incorrect answers. */
if (CodeSum == GuessSum && CodeProduct == GuessProduct)// Note double ampersand = AND operator.
{
std::cout << "Well done, Seeker, you have won the crystal!" <<std::endl;
}
else
{
std::cout << "Unfortunately that is not the correct code, Seeker"<<std::endl;
}
return 0;
}