Created
July 25, 2017 14:54
-
-
Save anonymous/a7167f9ac228d15214c0b87a31430dac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <conio.h> | |
void IntroGame(); | |
void PlayGame(); | |
std::string Quiz(); | |
bool EndGame(); | |
int main() | |
{ | |
IntroGame(); | |
PlayGame(); | |
EndGame(); | |
return 0; // exit app | |
} | |
void IntroGame() | |
{ | |
// Introduction of game | |
constexpr int NUMBER = 7; | |
std::cout << "########## QUIZ ##########\n" << std::endl; | |
std::cout << "Guess correctly " << NUMBER << " from 10 questions to win the Quiz!\n"; | |
std::cout << "Press any button to continue!\n"; | |
std::cout << std::endl; | |
_getch(); | |
return; | |
} | |
void PlayGame() | |
{ | |
// loop for the number of questions | |
constexpr int Questions = 10; | |
for (int q = 1; q < Questions; q++) | |
{ | |
Quiz(); | |
} | |
return; | |
// end loop | |
} | |
std::string Quiz() | |
{ | |
// Inicializing the game | |
std::string Answer = ""; | |
std::string Rep1 = "Jerry Rice"; | |
int points = 0; | |
std::cout << "QUESTION 1: Who holds the record for most receiving yards in history?\n"; | |
std::getline(std::cin, Answer); | |
if (Answer == Rep1) | |
{ | |
std::cout << std::endl << "YEAH!\n" << std::endl; | |
points = points++; | |
} | |
else { | |
std::cout << std::endl << "Oh oh! The correct answer is: " << Rep1 << std::endl << std::endl; | |
} | |
return Answer; | |
} | |
bool EndGame() | |
{ | |
// Finalizing the game | |
int WinLost = 0; | |
if (WinLost >= NUMBER) | |
{ | |
std::cout << "Congrats! You're not a rookie anymore (y/n)"; | |
} | |
else { | |
std::cout << "Are you sure what NFl is? Well... play again? (y/n)"; | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment