Hello! I’m enjoying this course so far. I got pretty far flawlessly but I’m kinda stumped on this one… I think I messed up somewhere and I need help solving the issue… Thanks!
#include <iostream>
void PrintIntroduction()
{
std::cout << "You are a secret agent breaking into a secure server room...\n";
std::cout << "enter the correct code to continue...\n\n";
}
void PlayGame()
{
PrintIntroduction();
//Declare 3 number code
const int CodeA = 4;
const int CodeB = 3;
const int CodeC = 2;
const int CodeSum = CodeA + CodeB + CodeC;
const int CodeProduct = CodeA * CodeB * CodeC;
// Print CodeSum and product to the terminal
std::cout << std::endl;
std::cout << "There are 3 numbers in the code" << std::endl;
std::cout << "The codes add-up to: " << CodeSum << std::endl;
std::cout << "+ The codes multiply to give: " << CodeProduct << std::endl;
//Store Player guess
int GuessA, GuessB, GuessC;
std::cin >> GuessA >> GuessB >> GuessC;
int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
//Check if the players guess is correct
if (GuessSum == CodeSum && GuessProduct == CodeProduct)
{
std::cout << "\nYou win!";
}
else
{
std::cout << "\nYou lose!";
}
int main();
{
PlayGame();
return 0;
}