Need Advice. Always return else statement

Bare with me for I am a true beginner here. I have went over this again and again until my brain hurts. It would seem that the code is entered correctly for my If and else statement, and yet even if I run the game and enter the correct 3 numbers it still prints the losing sentence. Any help is appreciated, I am sure I am missing something small.

#include <iostream> 

void Playgame()
    //Intro messages
std::cout << "You wake up with no memory of who or where you are. All you know is you need to escape this room.\n";
std::cout << "You see a door in front of you. It is locked with a three digit passcode. Enter the correct codes to unlock the door.\n \n";
   //Declaring our three digit code
    const int CodeA = 2;
    const int CodeB = 3;
    const int CodeC = 4;

    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;
//Player Input 
    int GuessA, GuessB, GuessC;
    std::cin >> GuessA >> GuessB >> GuessC;

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

//Correct or Incorrect Guesses
    if (GuessSum==CodeSum && GuessProduct==CodeProduct)

        std::cout << "\nYou Have Survived....For Now.";


        std::cout << "\nYou are attacked and killed";

//Main function
int main()
    return 0;

you int GuessProduct is still using + it should be GuessA * GuessB * GuessC;

Wow…I have to learn to pay closer attention. Thanks much!

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

Privacy & Terms