What does this error mean: too few arguments in function call?

What does this error mean: too few arguments in function call?
Here’s my code:

#include <iostream>

// Mitul Programmed This

void PrintIntroduction(int Difficulty)

{

    std::cout << "\n \n Welcome To TripleX. Your current level is \n" << Difficulty;

    std::cout << " You are a detective breaking into the secret sever rooms of a notorious cyberthief... \n";

    std::cout << "\n You need to enter the correct password to continue...\n";

}

bool PlayGame()

{

        PrintIntroduction();

       

   const int CodeA = 4;

   const int CodeB = 3;

   const int CodeC = 2;

const int CodeSum = CodeA + CodeB + CodeC;

const int CodeProduct = CodeA * CodeB * CodeC;

/*

        This is a 

        Multi-Line

        Comment!

*/

// To use \n here use \n at the start

std::cout << std::endl << std::endl;

std::cout << "There are 3 numbers in the code";

std::cout << "\n+ The codes add up to: " << CodeSum;

std::cout << "\n+ The codes multiply to give: " << CodeProduct << std::endl << std::endl;

int GuessA, GuessB, GuessC;

std::cin >> GuessA >> GuessB >> GuessC;

    int GuessSum = GuessA + GuessB + GuessC;

    int GuessProduct = GuessA * GuessB * GuessC;

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

    {

        std::cout << "You Win!";

        return true;

    }

    

    else

    {

        std::cout << "You Lose!";

        return false;

    }

}

int main()

{

    int LevelDifficulty = 1;

    while(true)

    {

        bool bLevelComplete = PlayGame();

        std::cin.clear(); // Clears Errors

        std::cin.ignore(); // clears buffers

        if (bLevelComplete)

        {

            ++LevelDifficulty;

        }

        

    }

        return 0;

    

}

PrintIntroduction in PlayGame(), as defined needs an integer parameter to be passed in that indicates the difficulty.

So, PrintIntroduction( 1 ) would work for example.

1 Like

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

Privacy & Terms