// Hangman
// The classic game of hangman
#include
<iostream>
#include
<string>
#include
<vector>
#include
<algorithm>
#include
<ctime>
#include
<cctype>
using
namespace std;
int
main()
{
//setup
const int MAX_WRONG = 8; //maximum number of incorrect guesses allowed
vector<string> words; //collection of possible words to guess
words.push_back(
"GUESS");
words.push_back(
"HANGMAN");
words.push_back(
"DIFFICULT");
srand(
static_cast<unsigned int>(time(0)));
random_shuffle(words.begin(), words.end());
const string THE_WORD = words[0]; //word to guess
int wrong = 0; //number of incorrect guesses
string soFar(THE_WORD.size(), '-'); //word guessed so far
string used = ""; //letters already guessed
cout <<
"Welcome to Hangman. Good luck!\n";
//main loop
while ((wrong < MAX_WRONG) && (soFar != THE_WORD))
{
cout <<
"\n\nYou have " << (MAX_WRONG - wrong);
cout <<
" incorrect guesses left.\n";
cout <<
"\nYou've used the following letters:\n" << used << endl;
cout <<
"\nSo far, the word is:\n" << soFar << endl;
char guess;
cout <<
"\n\nEnter your guess: ";
cin >> guess;
guess = toupper(guess);
//make uppercase since secret word in uppercase
while (used.find(guess) != string::npos)
{
cout <<
"\nYou've already guessed " << guess << endl;
cout <<
"Enter your guess: ";
cin >> guess;
guess = toupper(guess);
}
used += guess;
if (THE_WORD.find(guess) != string::npos)
{
cout <<
"That's right! " << guess << " is in the word.\n";
//update soFar to include newly guessed letter
for (int i = 0; i < THE_WORD.length(); ++i)
{
if (THE_WORD[i] MAX_WRONG)
{
cout <<
"\nYou've been hanged!";
}
else
{
cout <<
"\nYou guessed it!";
}
cout <<
"\nThe word was " << THE_WORD << endl;
return 0;
}
Holden visits Mr. Spencer to say Good-by.
The "Emperor's hangman" is the nickname that Mr. Beaver used to referred to the White Witch.
Holden considers Mr. Spencer to be phony because he believes Mr. Spencer is insincere and pretentious. He perceives Mr. Spencer as someone who doesn't genuinely care about him but rather is just going through the motions of pretending to be concerned about his academic performance.
Mr. Spencer was Holden's history teacher at Pencey Prep; he visits him because Mr. Spencer wanted to say goodbye to him and give him advice.
Mr. Spencer and Holden exchange ideas about Holden's academic performance and attitude towards school during their meeting. Mr. Spencer tries to counsel Holden about taking more responsibility and applying himself more diligently to his studies. Ultimately, Holden becomes frustrated with Mr. Spencer's well-meaning but condescending remarks.
His opinion of Mr. Spencer went down. He expected one thing to happen and he had a picture of what would happen when he visited the Spencer household. However, his expectations were squashed and he had to face the problems that Mr. Spencer posed when Holden was "let down."
Holden describes Mr. Spencer as old and boring, while he describes Mrs. Spencer as "old and decrepit." He finds them both to be out of touch with his feelings and disinterested in his well-being.
Holden talks to his old history teacher, Mr. Spencer, after the big fight. They have a conversation at Mr. Spencer's house.
Mr. Spencer seemed disappointed and concerned about Holden's expulsion. He tried to have a serious talk with Holden to understand his situation and offer guidance, but Holden did not take it seriously. Overall, Mr. Spencer likely felt frustrated that Holden was not taking his future seriously.
No connection between Spencer Silver and the "Spencer Silver Mansion" in Havre de Grace, Maryland. This B&B is owned by a Mr. Spencer and a Mr. Silver who combined their names for the B&B. Spencer Silver
Holden's opinion of Mr. Spencer declines during his visit. He finds Mr. Spencer's lecture annoying and condescending, feeling that he doesn't genuinely care about his well-being. Holden becomes increasingly irritated and disengaged during the conversation.
I believe it's Spencer