#include <iostream>
usingnamespace std; // now you can use cout instead of std::cout
// Returns true (1) until the correct answer is found. Then it returns false (0).
bool NumberGame(int x){
int y; // y is the user's input
cout << "Guess the number between 1 and 6" << endl;
cin >> y;
if (y == x){ // If answer is correct
cout << "wow you win" << endl;
return 0; // Return false and ends NumberGame() function
}
elseif (y > 6 || y < 1){ // If answer is outside of parameters
cout << "you're not even trying" << endl;
}
else { // If answer is within parameters but is incorrect
cout << "you lose" << endl;
}
return 1; // Returns true
}
int main(){
int x = 6; // x is the correct answer
while (NumberGame(x)); // While NumberGame() returns true (1)
return 0;
}