// Play a game of hangman. #include #include #include using namespace std; void FixAWord(string & ); string GetAWord(ifstream & wordFile); int main() { ifstream f; bool dn = false; double qq, pn, stx; int w1 = 0, gm = 0, tn; int i; string bl, sw, w; char an, lt; int x, q; f.open("phrases.txt"); cout << "Hello, welcome to hangman" << endl << endl; while(not dn) { gm ++; getline(f, w); cout << " gm " << gm << w << " w " << endl; if (not f) { f.close(); f.open("phrases.txt"); getline(f, w); } for(i=0;i= 1) cout <<'\\'; if (bl.size() < 1) cout << " "; if (bl.size()>= 2) cout << '0'; if (bl.size() < 2) cout << " "; if (bl.size() >= 3) { cout << '/'; } else { cout << " "; } cout << endl; cout << " | "; if (bl.size() >= 4) { cout << '|'; } else { cout << " "; } cout << endl; cout << " | "; if (bl.size() >= 5) { cout << '/'; } else { cout << " "; } cout << " "; if (bl.size() >= 6) { cout << '\\'; } else { cout << " "; } cout << endl; cout << " |" << endl; cout << "_+_______ "; for (i=0;i " << endl << endl;;;; cin >> lt; } while (not isalpha(lt)); cout << endl << endl; cout << "Here" << endl << endl; lt = tolower(lt); cout << lt << endl<= 6) { cout << " +--+" << endl << " | |" << endl << " | "; if (bl.size() >= 1) { cout << '\\'; } else { cout << " "; } if (bl.size() >= 2) { cout << '0'; } else { cout << " "; } if (bl.size() >= 3) { cout << '/'; } else { cout << " "; } cout << endl; cout << " | "; if (bl.size() >= 4) { cout << '|'; } else { cout << " "; } cout << endl; cout << " | "; if (bl.size() >= 5) { cout << '/'; } else { cout << " "; } cout << " "; if (bl.size() >= 6) { cout << '\\'; } else { cout << " "; } cout << endl; cout << " |" << endl; cout << "_+_______ "; for (i=0;i "; cin >> an; an = tolower(an); } while (an != 'y' and an != 'n'); dn = an != 'y'; } // end of main loop f.close(); cout << endl << "Games Played: " << gm << endl << "Games Won " << w1 << endl << "Thanks for playing! " << endl; return 0; }