# Triplex game

this is my TRIPLEX GAME code. hope to improve my coding skills in the next couple of months

``````#include<iostream>
#include<ctime>

bool PlayGame(int Difficulty)
{

std::cout << "You are in the level " << Difficulty ;

// our three random numbers
int const CodeA = rand() % Difficulty + Difficulty;
int const CodeB = rand() % Difficulty + Difficulty ;
int const CodeC = rand() % Difficulty + Difficulty;

// CodeSum of a,b,c
int const CodeSum = CodeA + CodeB + CodeC;
// CodeProduct of a,b,c
int const CodeProduct = CodeA * CodeB * CodeC;

std::cout << std::endl;
std::cout <<"+ The Three numbers in our code \n";
std::cout <<"+ The Code add-up gives : " << CodeSum << std::endl;
std::cout <<"+ The Code multiply gives  : " << CodeProduct << std::endl;

std::cout << "\n - Type your guess of the three Numbers followed by an x : " <<std::endl;

// Store Player Guesses
int answer ; // the three numbers guesses
int GeussProduct = 1;
int GeussSum = 0;

while(std::cin >> answer) // if the player types a charachter the loop ends
{
}

std::cin.clear();
std::cin.ignore();

if(GeussSum == CodeSum && GeussProduct == CodeProduct )
{
std::cout << "  GREAT YOU ARE INTO THE NEXT ROOM .... \n" << std::endl;
return true;
}
else
{
std::cout << "  WORNG CODE ... RETRY TRY AGAIN AGENT \n" << std::endl;
return false;
}

}

int main()
{

std::cout << "  Shhhhhhh You are a secret agent breaking into secure server room \n";
std::cout << " \n type the right code ........... \n \n";

srand(time(NULL));

const int MaxLevelDifficulty = 2 ;
int LevelDifficulty = 1;

while (LevelDifficulty <= MaxLevelDifficulty)
{

if( PlayGame(LevelDifficulty) )
{

LevelDifficulty++;
}

}

std::cout << " \n GREAT AGENT YOU HAVE MADE IT TO THE END " << std::endl;

return 0;
}
``````