TripleX Starter

std::cout << “You are a disgruntled worker looking into a secret recipe from your boss”;

std::cout << std::endl;

std::cout << "Enter the correct code to continue...";

// 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 CodeSum and CodePRoduct to the terminal

std::cout << std::endl;

std::cout << “+ There are 3 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 win!";

}

else{

   std::cout << "You were caught by the manager.";

   std::cout << "You were fired";

}

return 0;

}

1 Like

Fantastic job!

Privacy & Terms