NEED HELP WITH HANGMAN
I have to finish this program by friday and I have no idea how to do the rest. it cannot contain any loops.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#include <iostream>
#include <string>
using namespace std;
const int MAX_TRIES = 6;
const string TITLE_1 = "-------------------------";
const string TITLE_2 = "_ _";
const string TITLE_3 = "_ HANGMAN _";
const string TITLE_4 = "_ _";
const string TITLE_5 = "-------------------------";
const char REPLACE_LETTER = '_';
void main()
{
string gallows1 = "|-----|---";
string gallows2 = "| ";
string gallows3 = "| ";
string gallows4 = "| ";
string gallows5 = "| ";
string gallows6 = "|______ ";
string displayWord = "_ _ _ _ _ _";
string hiddenWord = "BASICS";
string alphabet = "ABCDEFGHIGKLMNOPQRSTUVWXYZ";
string hangedMan1, hangedMan2, hangedMan3;
char userGuess;
int guessCount = 0;
// Start screen.
cout << TITLE_1 << endl << TITLE_2 << endl << TITLE_3 << endl << TITLE_4 << endl << TITLE_5 << endl;
system("pause");
system("cls");
// Gallow Display.
cout << gallows1 << endl;
cout << gallows2 << hangedMan1 << endl;
cout << gallows3 << hangedMan2 << endl;
cout << gallows4 << hangedMan3 << endl;
cout << gallows5 << endl;
cout << gallows6 << endl << endl;
// HUD
cout << alphabet << endl;
cout << displayWord << endl << endl;
// User Guess
cout << "Your Guess: " << endl;
cin >> userGuess;
if (userGuess == hiddenWord[0])
{
displayWord[0] = hiddenWord[0];
}
else if (userGuess == hiddenWord[1])
{
displayWord[1] = hiddenWord[1];
}
else if (userGuess == hiddenWord[2])
{
displayWord[2] = hiddenWord[2];
}
else if (userGuess == hiddenWord[3])
{
displayWord[3] = hiddenWord[3];
}
else if (userGuess == hiddenWord[4])
{
displayWord[4] = hiddenWord[4];
}
else if (userGuess == hiddenWord[5])
{
displayWord[5] = hiddenWord[5];
}
system("pause");
}
|
Topic archived. No new replies allowed.