/* Hangman v1.0 */

#include <iostream.h>

using namespace std ;

// FUNCTIONS

void getword ( void ) ;

void getword2 ( void ) ;

void getword3 ( void ) ;

void easy ( void ) ;

void normal ( void ) ;

void hard ( void ) ;

void checkletter ( void ) ;

void checkletter2 ( void ) ;

void checkletter3 ( void ) ;

int main ( ) ;

// VARIABLES

bool runagain = false ;

char again = '0' ;

int worddone = 0 ;

char let1 = '0' ;

char let2 = '0' ;

char let3 = '0' ;

char let4 = '0' ;

char let5 = '0' ;

char let6 = '0' ;

char let7 = '0' ;

char let8 = '0' ;

char let9 = '0' ;

char let10 = '0' ;

char let11 = '0' ;

char let12 = '0' ;

char let13 = '0' ;

int let1done = 0 ;

int let2done = 0 ;

int let3done = 0 ;

int let4done = 0 ;

int let5done = 0 ;

int let6done = 0 ;

int let7done = 0 ;

int let8done = 0 ;

int let9done = 0 ;

int let10done = 0 ;

int let11done = 0 ;

int let12done = 0 ;

int let13done = 0 ;

char hang1 [ 30 ] = " ______

" ;

char hang2 [ 30 ] = " | |

" ;

char hang3 [ 30 ] = " |

" ;

char hang4 [ 30 ] = " |

" ;

char hang5 [ 30 ] = " |

" ;

char hang6 [ 30 ] = " |

" ;

char hang11 [ 30 ] = " ______

" ;

char hang12 [ 30 ] = " | |

" ;

char hang13 [ 30 ] = " | O

" ;

char hang14 [ 30 ] = " |

" ;

char hang15 [ 30 ] = " |

" ;

char hang16 [ 30 ] = " |

" ;

char hang21 [ 30 ] = " ______

" ;

char hang22 [ 30 ] = " | |

" ;

char hang23 [ 30 ] = " | O

" ;

char hang24 [ 30 ] = " | |

" ;

char hang25 [ 30 ] = " |

" ;

char hang26 [ 30 ] = " |

" ;

char hang31 [ 30 ] = " ______

" ;

char hang32 [ 30 ] = " | |

" ;

char hang33 [ 30 ] = " | O

" ;

char hang34 [ 30 ] = " | - |

" ;

char hang35 [ 30 ] = " |

" ;

char hang36 [ 30 ] = " |

" ;

char hang41 [ 30 ] = " ______

" ;

char hang42 [ 30 ] = " | |

" ;

char hang43 [ 30 ] = " | O

" ;

char hang44 [ 30 ] = " | - | -

" ;

char hang45 [ 30 ] = " |

" ;

char hang46 [ 30 ] = " |

" ;

char hang51 [ 30 ] = " ______

" ;

char hang52 [ 30 ] = " | |

" ;

char hang53 [ 30 ] = " | O

" ;

char hang54 [ 30 ] = " | - | -

" ;

char hang55 [ 30 ] = " | /

" ;

char hang56 [ 30 ] = " |

" ;

char hang61 [ 30 ] = " ______

" ;

char hang62 [ 30 ] = " | |

" ;

char hang63 [ 30 ] = " | O

" ;

char hang64 [ 30 ] = " | - | -

" ;

char hang65 [ 30 ] = " | / \\ " "

" ;

char hang66 [ 30 ] = " |

" ;

char blank1 ;

char blank2 ;

char blank3 ;

char blank4 ;

char blank5 ;

char blank6 ;

char blank7 ;

char blank8 ;

char blank9 ;

char blank10 ;

char blank11 ;

char blank12 ;

char blank13 ;

int blankcount ;

int lettercount ;

char guess ;

int hangercount = 0 ;

string guessword ;

// GET WORD

void getword ( void ) {

string words [ 10 ] = {

"that" ,

"help" ,

"rent" ,

"chair" ,

"clock" ,

"book" ,

"rose" ,

"table" ,

"video" ,

"room" } ;

int j ;

const int N = 10 ;

srand ( ( unsigned ) time ( NULL ) ) ;

for ( j = 0 ; j < 10 ; j ++ ) {

rand ( ) ;

}

j = ( int ) N * rand ( ) / ( RAND_MAX + 1.0 ) ;

guessword = words [ j ] ;

if ( guessword == "that" ) {

lettercount = 4 ;

blankcount = 4 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 't' ;

let2 = 'h' ;

let3 = 'a' ;

let4 = 't' ;

}

else if ( guessword == "help" ) {

lettercount = 4 ;

blankcount = 4 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'h' ;

let2 = 'e' ;

let3 = 'l' ;

let4 = 'p' ;

}

else if ( guessword == "rent" ) {

lettercount = 4 ;

blankcount = 4 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'r' ;

let2 = 'e' ;

let3 = 'n' ;

let4 = 't' ;

}

else if ( guessword == "chair" ) {

lettercount = 5 ;

blankcount = 5 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'c' ;

let2 = 'h' ;

let3 = 'a' ;

let4 = 'i' ;

let5 = 'r' ;

}

else if ( guessword == "clock" ) {

lettercount = 5 ;

blankcount = 5 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'c' ;

let2 = 'l' ;

let3 = 'o' ;

let4 = 'c' ;

let5 = 'k' ;

}

else if ( guessword == "book" ) {

lettercount = 4 ;

blankcount = 4 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'b' ;

let2 = 'o' ;

let3 = 'o' ;

let4 = 'k' ;

}

else if ( guessword == "rose" ) {

lettercount = 4 ;

blankcount = 4 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'r' ;

let2 = 'o' ;

let3 = 's' ;

let4 = 'e' ;

}

else if ( guessword == "table" ) {

lettercount = 5 ;

blankcount = 5 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 't' ;

let2 = 'a' ;

let3 = 'b' ;

let4 = 'l' ;

let5 = 'e' ;

}

else if ( guessword == "video" ) {

lettercount = 5 ;

blankcount = 5 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'v' ;

let2 = 'i' ;

let3 = 'd' ;

let4 = 'e' ;

let5 = 'o' ;

}

else if ( guessword == "room" ) {

lettercount = 4 ;

blankcount = 4 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 'r' ;

let2 = 'o' ;

let3 = 'o' ;

let4 = 'm' ;

}

return ;

}

// GET WORD 2

void getword2 ( void ) {

string words [ 10 ] = {

"octopus" ,

"monitor" ,

"manual" ,

"speakers" ,

"television" ,

"glasses" ,

"poster" ,

"mountain" ,

"keyboard" ,

"elephant" } ;

int j ;

const int N = 10 ;

srand ( ( unsigned ) time ( NULL ) ) ;

for ( j = 0 ; j < 10 ; j ++ ) {

rand ( ) ;

}

j = ( int ) N * rand ( ) / ( RAND_MAX + 1.0 ) ;

guessword = words [ j ] ;

if ( guessword == "octopus" ) {

lettercount = 7 ;

blankcount = 7 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

let1 = 'o' ;

let2 = 'c' ;

let3 = 't' ;

let4 = 'o' ;

let5 = 'p' ;

let6 = 'u' ;

let7 = 's' ;

}

else if ( guessword == "monitor" ) {

lettercount = 7 ;

blankcount = 7 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

let1 = 'm' ;

let2 = 'o' ;

let3 = 'n' ;

let4 = 'i' ;

let5 = 't' ;

let6 = 'o' ;

let7 = 'r' ;

}

else if ( guessword == "manual" ) {

lettercount = 6 ;

blankcount = 6 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

let1 = 'm' ;

let2 = 'a' ;

let3 = 'n' ;

let4 = 'u' ;

let5 = 'a' ;

let6 = 'l' ;

}

else if ( guessword == "speakers" ) {

lettercount = 8 ;

blankcount = 8 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

let1 = 's' ;

let2 = 'p' ;

let3 = 'e' ;

let4 = 'a' ;

let5 = 'k' ;

let6 = 'e' ;

let7 = 'r' ;

let8 = 's' ;

}

else if ( guessword == "television" ) {

lettercount = 10 ;

blankcount = 10 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

let1 = 't' ;

let2 = 'e' ;

let3 = 'l' ;

let4 = 'e' ;

let5 = 'v' ;

let6 = 'i' ;

let7 = 's' ;

let8 = 'i' ;

let9 = 'o' ;

let10 = 'n' ;

}

else if ( guessword == "glasses" ) {

lettercount = 7 ;

blankcount = 7 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

let1 = 'g' ;

let2 = 'l' ;

let3 = 'a' ;

let4 = 's' ;

let5 = 's' ;

let6 = 'e' ;

let7 = 's' ;

}

else if ( guessword == "poster" ) {

lettercount = 6 ;

blankcount = 6 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

let1 = 'p' ;

let2 = 'o' ;

let3 = 's' ;

let4 = 't' ;

let5 = 'e' ;

let6 = 'r' ;

}

else if ( guessword == "mountain" ) {

lettercount = 8 ;

blankcount = 8 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

let1 = 'm' ;

let2 = 'o' ;

let3 = 'u' ;

let4 = 'n' ;

let5 = 't' ;

let6 = 'a' ;

let7 = 'i' ;

let8 = 'n' ;

}

else if ( guessword == "keyboard" ) {

lettercount = 8 ;

blankcount = 8 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

let1 = 'k' ;

let2 = 'e' ;

let3 = 'y' ;

let4 = 'b' ;

let5 = 'o' ;

let6 = 'a' ;

let7 = 'r' ;

let8 = 'd' ;

}

else if ( guessword == "elephant" ) {

lettercount = 8 ;

blankcount = 8 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

let1 = 'e' ;

let2 = 'l' ;

let3 = 'e' ;

let4 = 'p' ;

let5 = 'h' ;

let6 = 'a' ;

let7 = 'n' ;

let8 = 't' ;

}

return ;

}

// GET WORD 3

void getword3 ( void ) {

string words [ 10 ] = {

"onomonopia" ,

"regardless" ,

"irresponsible" ,

"cornerstone" ,

"mummification" ,

"deathshroud" ,

"destruction" ,

"mountainous" ,

"compactdisc" ,

"deconstruct" } ;

int j ;

const int N = 10 ;

srand ( ( unsigned ) time ( NULL ) ) ;

for ( j = 0 ; j < 10 ; j ++ ) {

rand ( ) ;

}

j = ( int ) N * rand ( ) / ( RAND_MAX + 1.0 ) ;

guessword = words [ j ] ;

if ( guessword == "onomonopia" ) {

lettercount = 10 ;

blankcount = 10 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

let1 = 'o' ;

let2 = 'n' ;

let3 = 'o' ;

let4 = 'm' ;

let5 = 'o' ;

let6 = 'n' ;

let7 = 'o' ;

let8 = 'p' ;

let9 = 'i' ;

let10 = 'a' ;

}

else if ( guessword == "regardless" ) {

lettercount = 10 ;

blankcount = 10 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

let1 = 'o' ;

let2 = 'c' ;

let3 = 't' ;

let4 = 'o' ;

let5 = 'p' ;

let6 = 'u' ;

let7 = 's' ;

let8 = 'p' ;

let9 = 'u' ;

let10 = 's' ;

}

else if ( guessword == "irresponsible" ) {

lettercount = 13 ;

blankcount = 13 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

blank12 = '_' ;

blank13 = '_' ;

let1 = 'i' ;

let2 = 'r' ;

let3 = 'r' ;

let4 = 'e' ;

let5 = 's' ;

let6 = 'p' ;

let7 = 'o' ;

let8 = 'n' ;

let9 = 's' ;

let10 = 'i' ;

let11 = 'b' ;

let12 = 'l' ;

let13 = 'e' ;

}

else if ( guessword == "cornerstone" ) {

lettercount = 11 ;

blankcount = 11 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

let1 = 'c' ;

let2 = 'o' ;

let3 = 'r' ;

let4 = 'n' ;

let5 = 'e' ;

let6 = 'r' ;

let7 = 's' ;

let8 = 't' ;

let9 = 'o' ;

let10 = 'n' ;

let11 = 'e' ;

}

else if ( guessword == "mummification" ) {

lettercount = 13 ;

blankcount = 13 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

blank12 = '_' ;

blank13 = '_' ;

let1 = 'm' ;

let2 = 'u' ;

let3 = 'm' ;

let4 = 'm' ;

let5 = 'i' ;

let6 = 'f' ;

let7 = 'i' ;

let8 = 'c' ;

let9 = 'a' ;

let10 = 't' ;

let11 = 'i' ;

let12 = 'o' ;

let13 = 'n' ;

}

else if ( guessword == "deathshroud" ) {

lettercount = 11 ;

blankcount = 11 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

let1 = 'd' ;

let2 = 'e' ;

let3 = 'a' ;

let4 = 't' ;

let5 = 'h' ;

let6 = 's' ;

let7 = 'h' ;

let8 = 'r' ;

let9 = 'o' ;

let10 = 'u' ;

let11 = 'd' ;

}

else if ( guessword == "destruction" ) {

lettercount = 11 ;

blankcount = 11 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

let1 = 'd' ;

let2 = 'e' ;

let3 = 's' ;

let4 = 't' ;

let5 = 'r' ;

let6 = 'u' ;

let7 = 'c' ;

let8 = 't' ;

let9 = 'i' ;

let10 = 'o' ;

let11 = 'n' ;

}

else if ( guessword == "mountainous" ) {

lettercount = 11 ;

blankcount = 11 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

let1 = 'm' ;

let2 = 'o' ;

let3 = 'u' ;

let4 = 'n' ;

let5 = 't' ;

let6 = 'a' ;

let7 = 'i' ;

let8 = 'n' ;

let9 = 'o' ;

let10 = 'u' ;

let11 = 's' ;

}

else if ( guessword == "compactdisc" ) {

lettercount = 11 ;

blankcount = 11 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

let1 = 'c' ;

let2 = 'o' ;

let3 = 'm' ;

let4 = 'p' ;

let5 = 'a' ;

let6 = 'c' ;

let7 = 't' ;

let8 = 'd' ;

let9 = 'i' ;

let10 = 's' ;

let11 = 'c' ;

}

else if ( guessword == "deconstruct" ) {

lettercount = 11 ;

blankcount = 11 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

let1 = 'd' ;

let2 = 'e' ;

let3 = 'c' ;

let4 = 'o' ;

let5 = 'n' ;

let6 = 's' ;

let7 = 't' ;

let8 = 'r' ;

let9 = 'u' ;

let10 = 'c' ;

let11 = 't' ;

}

return ;

}

// CHECK LETTER

void checkletter ( void ) {

if ( guess == let1 && let1done ! = 1 ) {

cout << "Correct! " << guess << " is the first letter.

" ;

blank1 = guess ;

lettercount -- ;

let1done = 1 ;

}

else if ( guess == let2 && let2done ! = 1 ) {

cout << "Correct! " << guess << " is the second letter.

" ;

blank2 = guess ;

lettercount -- ;

let2done = 1 ;

}

else if ( guess == let3 && let3done ! = 1 ) {

cout << "Correct! " << guess << " is the third letter.

" ;

blank3 = guess ;

lettercount -- ;

let3done = 1 ;

}

else if ( guess == let4 && let4done ! = 1 ) {

cout << "Correct! " << guess << " is the fourth letter.

" ;

blank4 = guess ;

lettercount -- ;

let4done = 1 ;

}

else if ( guess == let5 && let5done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank5 = guess ;

lettercount -- ;

let5done = 1 ;

}

else {

cout << "Wrong! " << guess << " is not one of the letters.

" ;

hangercount ++ ;

}

easy ( ) ;

}

// CHECK LETTER 2

void checkletter2 ( void ) {

if ( guess == let1 && let1done ! = 1 ) {

cout << "Correct! " << guess << " is the first letter.

" ;

blank1 = guess ;

lettercount -- ;

let1done = 1 ;

}

else if ( guess == let2 && let2done ! = 1 ) {

cout << "Correct! " << guess << " is the second letter.

" ;

blank2 = guess ;

lettercount -- ;

let2done = 1 ;

}

else if ( guess == let3 && let3done ! = 1 ) {

cout << "Correct! " << guess << " is the third letter.

" ;

blank3 = guess ;

lettercount -- ;

let3done = 1 ;

}

else if ( guess == let4 && let4done ! = 1 ) {

cout << "Correct! " << guess << " is the fourth letter.

" ;

blank4 = guess ;

lettercount -- ;

let4done = 1 ;

}

else if ( guess == let5 && let5done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank5 = guess ;

lettercount -- ;

let5done = 1 ;

}

else if ( guess == let6 && let6done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank6 = guess ;

lettercount -- ;

let6done = 1 ;

}

else if ( guess == let7 && let7done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank7 = guess ;

lettercount -- ;

let7done = 1 ;

}

else if ( guess == let8 && let8done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank8 = guess ;

lettercount -- ;

let8done = 1 ;

}

else if ( guess == let9 && let9done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank9 = guess ;

lettercount -- ;

let9done = 1 ;

}

else if ( guess == let10 && let10done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank10 = guess ;

lettercount -- ;

let10done = 1 ;

}

else {

cout << "Wrong! " << guess << " is not one of the letters.

" ;

hangercount ++ ;

}

normal ( ) ;

}

// CHECK LETTER 3

void checkletter3 ( void ) {

if ( guess == let1 && let1done ! = 1 ) {

cout << "Correct! " << guess << " is the first letter.

" ;

blank1 = guess ;

lettercount -- ;

let1done = 1 ;

}

else if ( guess == let2 && let2done ! = 1 ) {

cout << "Correct! " << guess << " is the second letter.

" ;

blank2 = guess ;

lettercount -- ;

let2done = 1 ;

}

else if ( guess == let3 && let3done ! = 1 ) {

cout << "Correct! " << guess << " is the third letter.

" ;

blank3 = guess ;

lettercount -- ;

let3done = 1 ;

}

else if ( guess == let4 && let4done ! = 1 ) {

cout << "Correct! " << guess << " is the fourth letter.

" ;

blank4 = guess ;

lettercount -- ;

let4done = 1 ;

}

else if ( guess == let5 && let5done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank5 = guess ;

lettercount -- ;

let5done = 1 ;

}

else if ( guess == let6 && let6done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank6 = guess ;

lettercount -- ;

let6done = 1 ;

}

else if ( guess == let7 && let7done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank7 = guess ;

lettercount -- ;

let7done = 1 ;

}

else if ( guess == let8 && let8done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank8 = guess ;

lettercount -- ;

let8done = 1 ;

}

else if ( guess == let9 && let9done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank9 = guess ;

lettercount -- ;

let9done = 1 ;

}

else if ( guess == let10 && let10done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank10 = guess ;

lettercount -- ;

let10done = 1 ;

}

else if ( guess == let11 && let11done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank11 = guess ;

lettercount -- ;

let10done = 1 ;

}

else if ( guess == let12 && let12done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank12 = guess ;

lettercount -- ;

let10done = 1 ;

}

else if ( guess == let13 && let13done ! = 1 ) {

cout << "Correct! " << guess << " is the fifth letter.

" ;

blank13 = guess ;

lettercount -- ;

let10done = 1 ;

}

else {

cout << "Wrong! " << guess << " is not one of the letters.

" ;

hangercount ++ ;

}

hard ( ) ;

}

// EASY

void easy ( void )

{

if ( worddone == 0 ) {

getword ( ) ;

worddone = 1 ; }

if ( lettercount == 0 ) {

cout << "

You've won! The word was " << guessword << ".



" ;

cout << "

Would you like to play again? (Y)es or (N)o? " ;

cin >> again ;

if ( again == 'y' ) {

runagain = true ;

}

return ;

}

if ( hangercount == 0 ) {

cout << hang1 << endl ;

cout << hang2 << endl ;

cout << hang3 << endl ;

cout << hang4 << endl ;

cout << hang5 << endl ;

cout << hang6 << endl ;

}

if ( hangercount == 1 ) {

cout << hang11 << endl ;

cout << hang12 << endl ;

cout << hang13 << endl ;

cout << hang14 << endl ;

cout << hang15 << endl ;

cout << hang16 << endl ;

}

if ( hangercount == 2 ) {

cout << hang21 << endl ;

cout << hang22 << endl ;

cout << hang23 << endl ;

cout << hang24 << endl ;

cout << hang25 << endl ;

cout << hang26 << endl ;

}

if ( hangercount == 3 ) {

cout << hang31 << endl ;

cout << hang32 << endl ;

cout << hang33 << endl ;

cout << hang34 << endl ;

cout << hang35 << endl ;

cout << hang36 << endl ;

}

if ( hangercount == 4 ) {

cout << hang41 << endl ;

cout << hang42 << endl ;

cout << hang43 << endl ;

cout << hang44 << endl ;

cout << hang45 << endl ;

cout << hang46 << endl ;

}

if ( hangercount == 5 ) {

cout << hang51 << endl ;

cout << hang52 << endl ;

cout << hang53 << endl ;

cout << hang54 << endl ;

cout << hang55 << endl ;

cout << hang56 << endl ;

}

if ( hangercount == 6 ) {

cout << hang61 << endl ;

cout << hang62 << endl ;

cout << hang63 << endl ;

cout << hang64 << endl ;

cout << hang65 << endl ;

cout << hang66 << endl ;

cout << "

You've lost! Poor guy.

" ;

cout << "

The word was " << guessword << ".

" ;

cout << "

Would you like to play again? (Y)es or (N)o? " ;

cin >> again ;

if ( again == 'y' ) {

runagain = true ;

return ;

}

return ;

}

cout << "

" << endl ;

if ( blankcount == 4 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << endl ;

}

if ( blankcount == 5 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << endl ;

}

cout << "

Enter your guess: " ;

cin >> guess ;

cout << "

You guessed the letter " << guess << ".

" ;

checkletter ( ) ;

}

// NORMAL

void normal ( void )

{

if ( worddone == 0 ) {

getword2 ( ) ;

worddone = 1 ; }

if ( lettercount == 0 ) {

cout << "

You've won! The word was " << guessword << ".



" ;

cout << "

Would you like to play again? (Y)es or (N)o? " ;

cin >> again ;

if ( again == 'y' ) {

runagain = true ;

return ;

}

return ;

}

if ( hangercount == 0 ) {

cout << hang1 << endl ;

cout << hang2 << endl ;

cout << hang3 << endl ;

cout << hang4 << endl ;

cout << hang5 << endl ;

cout << hang6 << endl ;

}

if ( hangercount == 1 ) {

cout << hang11 << endl ;

cout << hang12 << endl ;

cout << hang13 << endl ;

cout << hang14 << endl ;

cout << hang15 << endl ;

cout << hang16 << endl ;

}

if ( hangercount == 2 ) {

cout << hang21 << endl ;

cout << hang22 << endl ;

cout << hang23 << endl ;

cout << hang24 << endl ;

cout << hang25 << endl ;

cout << hang26 << endl ;

}

if ( hangercount == 3 ) {

cout << hang31 << endl ;

cout << hang32 << endl ;

cout << hang33 << endl ;

cout << hang34 << endl ;

cout << hang35 << endl ;

cout << hang36 << endl ;

}

if ( hangercount == 4 ) {

cout << hang41 << endl ;

cout << hang42 << endl ;

cout << hang43 << endl ;

cout << hang44 << endl ;

cout << hang45 << endl ;

cout << hang46 << endl ;

}

if ( hangercount == 5 ) {

cout << hang51 << endl ;

cout << hang52 << endl ;

cout << hang53 << endl ;

cout << hang54 << endl ;

cout << hang55 << endl ;

cout << hang56 << endl ;

}

if ( hangercount == 6 ) {

cout << hang61 << endl ;

cout << hang62 << endl ;

cout << hang63 << endl ;

cout << hang64 << endl ;

cout << hang65 << endl ;

cout << hang66 << endl ;

cout << "

You've lost! Poor guy.

" ;

cout << "

The word was " << guessword << ".

" ;

cout << "

Would you like to play again? (Y)es or (N)o? " ;

cin >> again ;

if ( again == 'y' ) {

runagain = true ;

}

return ;

}

cout << "

" << endl ;

if ( blankcount == 6 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << " " << blank6 << endl ;

}

if ( blankcount == 7 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << " " << blank6 << " " << blank7 << endl ;

}

if ( blankcount == 8 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << " " << blank6 << " " << blank7 << " " << blank8 << endl ;

}

if ( blankcount == 10 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << " " << blank6 << " " << blank7 << " " << blank8 << " " << blank9 << " " << blank10 << endl ;

}

cout << "

Enter your guess: " ;

cin >> guess ;

cout << "

You guessed the letter " << guess << ".

" ;

checkletter2 ( ) ;

}

// HARD

void hard ( void )

{

if ( worddone == 0 ) {

getword3 ( ) ;

worddone = 1 ; }

if ( lettercount == 0 ) {

cout << "

You've won! The word was " << guessword << ".



" ;

cout << "

Would you like to play again? (Y)es or (N)o? " ;

cin >> again ;

if ( again == 'y' ) {

runagain = true ;

return ;

}

return ;

}

if ( hangercount == 0 ) {

cout << hang1 << endl ;

cout << hang2 << endl ;

cout << hang3 << endl ;

cout << hang4 << endl ;

cout << hang5 << endl ;

cout << hang6 << endl ;

}

if ( hangercount == 1 ) {

cout << hang11 << endl ;

cout << hang12 << endl ;

cout << hang13 << endl ;

cout << hang14 << endl ;

cout << hang15 << endl ;

cout << hang16 << endl ;

}

if ( hangercount == 2 ) {

cout << hang21 << endl ;

cout << hang22 << endl ;

cout << hang23 << endl ;

cout << hang24 << endl ;

cout << hang25 << endl ;

cout << hang26 << endl ;

}

if ( hangercount == 3 ) {

cout << hang31 << endl ;

cout << hang32 << endl ;

cout << hang33 << endl ;

cout << hang34 << endl ;

cout << hang35 << endl ;

cout << hang36 << endl ;

}

if ( hangercount == 4 ) {

cout << hang41 << endl ;

cout << hang42 << endl ;

cout << hang43 << endl ;

cout << hang44 << endl ;

cout << hang45 << endl ;

cout << hang46 << endl ;

}

if ( hangercount == 5 ) {

cout << hang51 << endl ;

cout << hang52 << endl ;

cout << hang53 << endl ;

cout << hang54 << endl ;

cout << hang55 << endl ;

cout << hang56 << endl ;

}

if ( hangercount == 6 ) {

cout << hang61 << endl ;

cout << hang62 << endl ;

cout << hang63 << endl ;

cout << hang64 << endl ;

cout << hang65 << endl ;

cout << hang66 << endl ;

cout << "

You've lost! Poor guy.

" ;

cout << "

The word was " << guessword << ".

" ;

cout << "

Would you like to play again? (Y)es or (N)o? " ;

cin >> again ;

if ( again == 'y' ) {

runagain = true ;

}

return ;

}

cout << "

" << endl ;

if ( blankcount == 10 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << " " << blank6 << " " << blank7 << " " << blank8 << " " << blank9 << " " << blank10 << endl ;

}

if ( blankcount == 11 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << " " << blank6 << " " << blank7 << " " << blank8 << " " << blank9 << " " << blank10 << " " << blank11 << endl ;

}

if ( blankcount == 13 ) {

cout << blank1 << " " << blank2 << " " << blank3 << " " << blank4 << " " << blank5 << " " << blank6 << " " << blank7 << " " << blank8 << " " << blank9 << " " << blank10 << " " << blank11 << " " << blank12 << " " << blank13 << endl ;

}

cout << "

Enter your guess: " ;

cin >> guess ;

cout << "

You guessed the letter " << guess << ".

" ;

checkletter3 ( ) ;

}

// MAIN

int main ( void )

{

runagain = false ;

blankcount = 0 ;

worddone = 0 ;

lettercount = 20 ;

hangercount = 0 ;

let1 = '0' ;

let2 = '0' ;

let3 = '0' ;

let4 = '0' ;

let5 = '0' ;

let6 = '0' ;

let7 = '0' ;

let8 = '0' ;

let9 = '0' ;

let10 = '0' ;

let11 = '0' ;

let12 = '0' ;

let12 = '0' ;

let1done = 0 ;

let2done = 0 ;

let3done = 0 ;

let4done = 0 ;

let5done = 0 ;

let6done = 0 ;

let7done = 0 ;

let8done = 0 ;

let9done = 0 ;

let10done = 0 ;

let11done = 0 ;

let12done = 0 ;

let13done = 0 ;

blank1 = '_' ;

blank2 = '_' ;

blank3 = '_' ;

blank4 = '_' ;

blank5 = '_' ;

blank6 = '_' ;

blank7 = '_' ;

blank8 = '_' ;

blank9 = '_' ;

blank10 = '_' ;

blank11 = '_' ;

blank12 = '_' ;

blank13 = '_' ;

int mode = 0 ;

unsigned int option = 0 ;

cout << "

Welcome to Hangman v1.0



Please select an option.



1. Start a game of hangman.

2. Exit Hangman.



Enter selection: " ;

cin >> option ;

cout << "

" ;

if ( option == 1 ) {

cout << "Please select a difficulty level.

1. Easy

2. Normal

3. Hard

4. About difficulty levels



Enter selection: " ;

cin >> mode ;

}

if ( option == 2 ) {

return 0 ;

}

if ( mode == 1 ) {

cout << "

Easy mode selected.



" ;

easy ( ) ;

}

else if ( mode == 2 ) {

cout << "

Normal mode selected.



" ;

normal ( ) ;

}

else if ( mode == 3 ) {

cout << "

Hard mode selected.



" ;

hard ( ) ;

}

else if ( mode == 4 ) {

cout << "

Easy mode contains smaller words.

Normal mode contains medium words.

Hard mode contains long words.



" ;

cout << "Please select a difficulty level.

1. Easy

2. Normal

3. Hard



Enter selection: " ;

cin >> mode ;

}

if ( option ! = 1 || option ! = 2 || option ! = 0 ) {

cout << "This is not a valid option. Please select 1 or 2.

" ;

main ( ) ;

}

if ( runagain == true ) {

main ( ) ;

}

return 0 ;