My TripleX code so far

#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;

}

#include

int main()
{
//Treasure Box Game, 2020
std::cout << “You are trying to open a treasure box.”;
std::cout << std::endl;
std::cout << “You need the correct code and the treasure is yours!” << std::endl;

// Delare numbers
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 to temnal
std::cout << std::endl;
std::cout << "+ There are three 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; 

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 << "You're Rich!" << std:: endl;
}
else

    std::cout << "No Dinero..." << std:: endl;

return 0;

}

Privacy & Terms