I don’t really know why, but when I compile my TripleX game and I put the correct answer the difficulty is still the same. Thank you.
#include <iostream>
#include <windows.h>
void PrintTitle()
{
std::cout << R"(
______ ___ __ __ ____ __ __ __ __ ____ ____ _____ __ __
/\__ _\ __ /\_ \ /\ \ /\ \ /\ _`\ /\ \/\ \/\ \/\ \/\ _`\ /\ _`\ /\ __`\/\ \/\ \
\/_/\ \/ _ __ /\_\ _____\//\ \ __ \ `\`\/'/' \ \ \/\ \ \ \ \ \ \ `\\ \ \ \L\_\ \ \L\_\ \ \/\ \ \ `\\ \
\ \ \/\`'__\/\ \/\ '__`\\ \ \ /'__`\`\/ > < \ \ \ \ \ \ \ \ \ \ , ` \ \ \L_L\ \ _\L\ \ \ \ \ \ , ` \
\ \ \ \ \/ \ \ \ \ \L\ \\_\ \_/\ __/ \/'/\`\ \ \ \_\ \ \ \_\ \ \ \`\ \ \ \/, \ \ \L\ \ \ \_\ \ \ \`\ \
\ \_\ \_\ \ \_\ \ ,__//\____\ \____\ /\_\\ \_\ \ \____/\ \_____\ \_\ \_\ \____/\ \____/\ \_____\ \_\ \_\
\/_/\/_/ \/_/\ \ \/ \/____/\/____/ \/_/ \/_/ \/___/ \/_____/\/_/\/_/\/___/ \/___/ \/_____/\/_/\/_/
\ \_\
\/_/)";
}
void PrintIntroductoryText()
{
// Introductory text
std::cout << "\n\nYou are an adventurer gathering loot in a dungeon...\n";
}
void PrintDragonPicture()
{
std::cout << R"(
^ ^
|\ \ / /|
/ \ |\__ __/| / \
/ /\ \ \ _ \/ _ / / \
/ / /\ \ {*}\/{*} / / \ \
| | | \ \( (00) ) / // |\ \
| | | |\ \(V""V)\ / / | || \|
| | | | \ |^--^| \ / / || || ||
/ / / | |( WWWW__ \/ /| || || ||
| | | | | | \______\ / / || || ||
| | | / | | )|______\ ) | / | || ||
/ / / / / /______/ /| \ \ || ||
/ / / / / /\_____/ |/ /__\ \ \ \ \
| | | / / /\______/ \ \__| \ \ \
| | | | | |\______ __ \_ \__|_| \
| | ,___ /\______ _ _ \_ \ |
| |/ /\_____ / \ \__ \ | /\
|/ | |\______ | | \___ \ |__/ \
v | |\______ | | \___/ |
| |\______ | | __/
\ \________\_ _\ ____/
__/ /\_____ __/ / )\_, _____/
/ ___/ \uuuu/ ___/___) \______/)" << '\n';
}
void PrintWhatTheDragonSays()
{
std::cout << "\n-I'm the Great Dragon. If you want my gold, you must answer wisely the following riddles...";
}
void PrintDifficulty(int Difficulty)
{
std::cout << "\nRiddle number " << Difficulty << ":\n";
}
bool PlayGame(int Difficulty)
{
PrintDifficulty(Difficulty);
// Constants of the 1st level
const int CodeA = 5;
const int CodeB = 7;
const int CodeC = 2;
// Information for the player
int CodeSum = CodeA + CodeB + CodeC;
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::cout << "\n+ The numbers add-up to: " << CodeSum;
std::cout << "\n+ The product of the numbers is: " << CodeProduct << std::endl;
// Store player guess
int GuessA, GuessB, GuessC;
std::cin >> GuessA >> GuessB >> GuessC;
int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
// Check if the player's guess is correct
if (GuessSum == CodeSum)
{
std::cout << "\nYou answerd correctly, little adventurer!\n";
return true;
}
else
{
std::cout << "\nYour ambition for gold has conduced you to an horrible fate. Now, you must die!";
return false;
}
}
int main()
{
system("color 0A"); //Set the text color in green
int LevelDifficulty = 1;
PrintTitle(); //Print the title of the game
PrintIntroductoryText(); //Print introductory text
PrintDragonPicture();
PrintWhatTheDragonSays();
PlayGame(LevelDifficulty);
while(true)
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear(); //Clear errors
std::cin.ignore(); //Discard the buffer
if (bLevelComplete)
{
++ LevelDifficulty;
}
}
return 0;
}```



