Triplex program won't compile

Hi, just started yesterday with c++ fundamentals and I ran into a problem. It will compile and also works, but there is a lot of text after compiling that i don’t understand and just wanna make sure there isn’t a problem with the setting of vscode. It started after creating parameters into PrintIntroduction function. I thought it was something in my code so I totally copied one from the course, but still it is still the same. Is there anything i can do with it? Thanks :slight_smile:

#include <iostream>

void PrintIntroduction(int Difficulty)
{
    std::cout << "\n\nYou are a secret agent breaking into a level  " << Difficulty;
    std::cout << " secure server room...\nEnter the correct code to continue...\n\n";
}

bool PlayGame()
{
    PrintIntroduction(7);

    const int CodeA = 4;
    const int CodeB = 3;
    const int CodeC = 2;

    const int CodeSum = CodeA + CodeB + CodeC;
    const int CodeProduct = CodeA * CodeB * CodeC;

    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;

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

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


    if (CodeProduct == GuessProduct && CodeSum == GuessSum)
    {
        std::cout << "\nYou win!";
        return true;
    }
    else
    {
        std::cout << "\nYou lose!";
        return false;
    }
}
int main()
{
    int LevelDifficulty = 1;
    while(true)
    {
        bool bLevelComplete = PlayGame();
        std::cin.clear();
        std::cin.ignore();

        if (bLevelComplete)
        {
            ++LevelDifficulty;
        }
    }

    return 0;
}

And it results to this:

x.cpp
D:\Apps\Visual Studio\VC\Tools\MSVC\14.30.30705\include\istream(488): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
D:\Apps\Visual Studio\VC\Tools\MSVC\14.30.30705\include\istream(482): note: while compiling class template member function 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::ignore(std::streamsize,int)'
x.cpp(49): note: see reference to function template instantiation 'std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::ignore(std::streamsize,int)' being compiled        
x.cpp(25): note: see reference to class template instantiation 'std::basic_istream<char,std::char_traits<char>>' being compiled
Microsoft (R) Incremental Linker Version 14.30.30705.0
Copyright (C) Microsoft Corporation.  All rights reserved.

EDIT: I found the mistake

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

Privacy & Terms