I am supposed to make a program that tells how many letters are in the word "hangman". And displays "You lose" after six wrong guesses and "You Win!" after guessing all the correct letters. This is what I have so far and I don't know where to go from here. I would be most appreciative if anyone could help.
#include <iostream>
using namespace std;
int main()
{ char letter;
try;
while (try <= 6)
cout << "Guess a letter" << endl;
cin >> letter;
if (letter == 'h' || letter == 'g' || letter == 'm'){
cout << "There is one." << endl;
}
else if (letter == 'a' || letter == 'n'){
cout << "There is two." << endl;
}
else {
try++
cout << "There are none." << endl;
}
the number of tries only diminishes when guessing correct letters.
So if a user enters 'a' (there are two in the word), you lose a guess?
And if you enter 'x', you don't lose a guess?
In that case, you could have an unlimited amount of guesses if you keep guessing incorrectly.