Advertisement
KillianMills

main.cpp

Oct 1st, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.36 KB | None | 0 0
  1. #include "hangman.h"
  2.  
  3. #include <iostream>
  4.  
  5. int main()
  6. {
  7.     bool b=false; // boolean for debug on/off
  8.     char choice; // for chosing to play or not
  9.     char mode; // for chosing debug mode or not
  10.     std::cout<< "\n\n" <<"          ------WELCOME TO MY FIRST GAME: HANGMAN------"<< "\n\n" << "WOULD YOU LIKE TO PLAY? Y/N: ";
  11.     std::cin>> choice;
  12.    
  13.     std::cout<< "\n\n"<< "WOULD YOU LIKE TO ENTER DEBUG MODE? Y/N: " ;
  14.     std::cin>> mode ;
  15.    
  16.     if(mode=='Y' || mode == 'y'){
  17.         std::cout<< "\n" << "                ------ENTERING DEDBUG MODE------"<< "\n\n";
  18.         b = true;
  19.     }
  20.     else {
  21.         std::cout<< "\n" << "                ------ENTERING NORMAL GAME------"<< "\n\n";
  22.         b = false;
  23.     }
  24.        
  25.     while(choice=='y' || choice=='Y'){ // lets the game be played again while the user does not input n or N
  26.    
  27.         hangman h(b);
  28.         h.inputGuesses(); // user inputs the amount of guesses allowed
  29.         h.inputWordSize(); // user inputs size of word to be used
  30.         h.dashX(); // creates a string of - of length of word
  31.         h.readFile(); // reads dictionary file
  32.         h.difficulty(); // reads words of size word into vector
  33.    
  34.         h.mainGame(); // user guesses characters
  35.         h.ending(); // end of game, print win or loss
  36.        
  37.         std::cout<< "Do you want to play again? Y/N: ";
  38.         std::cin>> choice;
  39.        
  40.         if(choice=='n' || choice=='N'){
  41.             break;
  42.         }
  43.     }
  44.    
  45.     std::cout << "\n\n" << "GOOD BYE." << "\n\n" ;
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement