I’ve been through the tutorials again and again but still my code will not compile and I get this message.
Hi All, Any ideas why I’m getting this message? ‘bLevelComplete’: undeclared identifier.
#include
void PrintIntroduction(int Difficulty)
{
std::cout << "\nYou are stuck, However, to break out of this stuckness version: " << Difficulty;
std::cout << "you can manifest 3 numbers to break the vortex\n\n";
std::cout << "OK manafest the numbers...\n";
}
bool PlayGame(int Difficulty)
{
PrintIntroduction(Difficulty);
int CodeA = 4;
int CodeB = 3;
int CodeC = 2;
int CodeSum = CodeA + CodeB + CodeC;
int CodeProduct = CodeA * CodeB * CodeC;
std::cout << "There are 3 Numbers in the code";
std::cout << "\nThey add-up to: " << CodeSum;
std::cout << "\nThe numbers multiply to give: " << CodeProduct << std::endl;
int GuessA, GuessB, GuessC;
std::cin >> GuessA >> GuessB >> GuessC;
int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
//Check if player is correct
if (GuessSum == CodeSum && GuessProduct == CodeProduct)
{
std::cout << "You Win!\n";
return true;
}
else
{
std::cout << "You Lose !\n\n\n\n";
return false;
}
}
int main()
{
int LevelDifficulty = 1;
const int MaxDifficulty = 5;
while (LevelDifficulty <= MaxDifficulty) //Looop game until all levels completed
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear(); //Clears any errors
std::cin.ignore();//Discards the buffer
}
if (bLevelComplete)
{
//Increase the level difficulty
++LevelDifficulty;
}
return 0;
}