Creating Hangman Game

So i'm trying to create a hangman game using C++ to get to understand the language better however i cannot figure out how i'm supposed to make my array print out a random word, hide it, print out the letters that haven't been guessed taking one away every time it's guessed with only 8 lives, maybe some ASCII graphics to show how the man is being hung, print out the hidden word after the player has guessed or failed to guess it, and a restart option. So far i have created a menu:

#include <iostream>
#include <ctime>

int main()
{
int choice = 0; // integers
bool startGame = true; // boolean for the while loop
char word_list[25][10] = {"horse", "pig", "cat", "dog", "lion", "fish", "hippo", "rhino", "gyraffe", "snake", "cheetah", "hamster", "rabbit", "sloth", "panda", "zebra", "chicken", "cow", "owl", "monkey", "penguin", "elephant", "duck", "wolf", "kangaroo"}; // array of animals
srand(time(NULL));

system("color b"); // light blue text
std::cout << "Welcome to Animal Hangman!\n"; // starting text

while (startGame != false) // loop to come back
{
std::cout << "\nWhich menu would you like to access?"; // text asking for menu input
std::cout << "\nPlease input '1' to start the game"; // "1" for start
std::cout << "\nPlease input '2' to hear the rules of hangman"; // "2" for rules
std::cout << "\nPlease input '3' to exit the program > "; // "3" for exit
std::cin >> choice;

system("cls"); // clears the screen

switch (choice) // switch for the menus depending on choice
{
case 1: // start of game, rest of code
std::cout << "BEGIN!";
// Rest of code here for the programming














break;

case 2: // displays rules of the game
std::cout << "The rules of hangman are, you have 8 lives.";
std::cout << "\nYou will be given a random word based on a type of animal";
std::cout << "\nand you will need to guess the word by guessing one letter at a time.";
std::cout << "\nEvery time you get a letter wrong, the man will be closer";
std::cout << "\nto being hung, and your job is to prevent him from being hung.";
std::cout << "\nSo everytime you get a letter wrong, you will lose a life.";
std::cout << "\n";

break; // breaks the loop, returning to the menu

case 3: // if the game has ended / no longer started, loop breaks
startGame = false;
break; // breaks the loop

default:
std::cout << "That doesn't work."; // prints when someone inputted any other number than 1, 2 or 3
std::cout << "\nPlease pick a number from the choices you were given > "; // prints
std::cin >> choice; // allows for more input for choice
break; // breaks the loop
}
}
}

I was also informed by a friend that I can use Cstrings but im not sure exactly how they work... Any help is welcome thank you.
bump.
Search the beginners forum for hangman. There are many sample hangman programs.

i cannot figure out how i'm supposed to make my array print out a random word

You're already calling srand(), so I'm assuming you're familiar with rand().
http://www.cplusplus.com/reference/cstdlib/rand/

Simply generate a random number between 0 and 24, then use that as an index to your list of animals. Create two variables. One to hold the chosen word (hidden) and one to hold what has been guessed (guess). Copy the random word to hidden. Fill guess with '*'. As the user guesses letters, fill in the appropriate positions in guess.

I strongly suggest you use std::string rather than C strings.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Topic archived. No new replies allowed.