Error error C3861: 'Playgame': identifier not found?

So this is my could till lecture 27: Function Parameters,

#include <iostream>
using namespace std;

void PrintIntroduction(int Difficulty)
{
    cout << "You are a student of IUB and your grades are low. You are in level " << Difficulty << endl;
    cout << "If you do not hack into IRAS and change your grades as soon as possible you'll fail!" << endl;
}

bool PlayGame()
{
    PrintIntroduction(7);
    
    // Declaring 3 number code
    const int CodeA = 3;
    const int CodeB = 1;
    const int CodeC = 3;
    
    const int CodeSum = CodeA + CodeB + CodeC;

    const int CodeProduct = CodeA * CodeB * CodeC;

    // Print CodeSum and CodeProduct to the terminal
    cout << endl;

    cout << "The password is in 3 numbers" << endl;
    cout << "The numbers add up to: " << CodeSum << endl;
    cout << "The codes multiply to give: " << CodeProduct << endl;
    
    // Store playesrs guess
    int GuessA, GuessB, GuessC;
    cin >> GuessA >> GuessB >> GuessC;
    
    cout << endl;

    int GuessSum = GuessA + GuessB + GuessC;
    int GuessProduct = GuessA * GuessB * GuessC;

    // Check if players guess is correct
    if (GuessSum == CodeSum && GuessProduct == CodeProduct)
    {
        cout << "You Win!" << endl << endl;
        return true;
    }
    else
    {
        cout << "You got caught....." << endl << endl;
        return false;
    }
    

}

int main()
{   
    int LevelDifficulty = 1;
    while (true)
    {
        bool bLevelComplete = Playgame();
        cin.clear(); // Clears any errors 
        cin.ignore(); // Discards the buffer

        if (bLevelComplete)
        {
            ++LevelDifficulty;
        }
        
    }

    
    cout << endl;
    return 0;
}


So I don’t understand why suddenly they are showing this code and why it wont even run now. Can someone please help? Thank you!

1 Like

The function is called PlayGame but you’re calling Playgame (upper case versus lower case g in Game) names like these are case sensitive meaning PlayGame and Playgame are not the same.

2 Likes

Oh god so silly! Damn! Thank you so much! :slight_smile:

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

Privacy & Terms