Boolean/Compile Error?

Not sure what the error is here? I followed along in all the lessons so far and it was working great, but today i’ve been getting this error, unable to run the program.

Can you copy/paste the code?

#include

void PrintIntroduction()

{

std::cout << "\n\nYou are a Pirate Hunter, looking for some dangerous criminal pirates.\nThey have run away and hid into what is called the Dungeon of Doom You have stumbled upon a locked door, which requires a code to open, currently set on level ";

std::cout << "\n\n\n You must enter the correct code to continue...\n\n";

}

bool PlayGame()

{

PrintIntroduction()

//Declaring 3 number code Variables

const int CodeA = 2;

const int CodeB = 3;

const int CodeC = 6;

const int CodeSum = CodeA + CodeB + CodeC;

const int CodeProduct = CodeA * CodeB * CodeC;



//Outputting the sum and product of the variable declared earlier

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 numbers multiply to give: " << CodeProduct << std::endl;

int GuessA, GuessB, GuessC;



std::cout << std::endl;

std::cin >> GuessA;

std::cin >> GuessB;

std::cin >> GuessC;

const int GuessSum = GuessA + GuessB + GuessC;

const int GuessProduct = GuessA * GuessB * GuessC;

if(GuessSum == CodeSum && GuessProduct == CodeProduct)

{

    std::cout << "\nGreat Job! You're In!";

    return true;

}

else {

    std::cout << "\nThe code was incorrect! You were caught by the Pirates and were eaten by the Kraken!! Better Luck Next Time!";

    return false;

}

}

int main()

{

int LevelDifficulty = 1;

while(true)

{

    bool bLevelComplete = PlayGame;

    std::cin.clear(); //Clears all errors

    std::cin.ignore(); //Discards the buffer



    if (bLevelComplete)

    {

        ++LevelDifficulty;

    }

    

}

return 0;

}

bool bLevelComplete =PlayGame();

You missed the ().

1 Like

ahhh i see… Thank you Very Much!!!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.