Code of tripleX game so far

#include

int main()
{
//Print welcome msg to terminal
std::cout << “You are a secret agent breaking into a secure room”;
std::cout << std::endl;
std::cout << “You need to enter the correct codes to continue…” << std::endl;

//Declare three number code
const int CodeA = 4;
const int CodeB = 5;
const int CodeC = 6;

const int CodeSum = CodeA + CodeB + CodeC;
const int CodeProduct = CodeA * CodeB * CodeC;

//print sum and product to the terminal
std::cout << std::endl;
std::cout<< "There are 3 numbers in the code " <<std::endl;
std::cout << "The codes add upto " << CodeSum << std::endl;
std::cout << "The code multipication is " << CodeProduct << std::endl;

int GuessA, GuessB, GuessC;
std::cin >> GuessA;
std::cin >> GuessB;
std::cin >> GuessC;
std::cout << "You entered: " << GuessA << GuessB << GuessC << std::endl;;


int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
std::cout << " The sum of guess is " << GuessSum << std::endl;;
std::cout << " The product of guess is " << GuessProduct << std::endl;

if (GuessSum == CodeSum && GuessProduct == CodeProduct)
{
    std::cout << " You Win!!";
}
else 
{
    std::cout << " OH!! You lost!!  ";
}
return 0;

}

Privacy & Terms