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!