Wap for the game hangman-using functions with txt graphics, C/C++ Programming

The game of hangman may have originated in the Victorian era, and involves trying to guess a word by suggesting letters. The game is played as follows: A word is chosen and the player is invited to guess the word one letter at a time.

A version of hangman using a program would prompts the user by displaying correct guesses in position after each round of guessing. For the ?rst round an underscore character for each letter in the word is displayed. For example, suppose that the computer chooses the word bench, from the dictionary the computer would display 5 underscore(_) or dash(-) characters:

!- - - - -

The player then guesses a character that they think is in the word. In the above example, any of the characters b, e, n, c, and h would be correct guesses as they appear in the word bench. When a correct character is guessed, this character is displayed in all the positions it appears in the word. If, for example, the player guessed the letter e, then the letter e would be displayed in position 2:

!- e - - -

If an incorrect guess is made the player is informed and the game increments the number of incorrect guesses. As the game progresses, the player gradually guesses more characters that appear in the word. The game ends when either all the characters in the word are guessed and the word is revealed (in this case the player wins), or a speci?ed, maximum number of incorrect guesses are reached (the player loses).
Consider the following sample program output (with 10 guesses):

Enter a word (up to 6 letters): frei  
Welcome to H A N G M A N
You must attempt to guess a word of length: 4

    ---Previous guesses: 

       Guess a character? f


Previous guesses: f

Guess a character? u
Incorrect guess: 1


Previous guesses: fu
Guess a character? i


Previous guesses: fui
Guess a character? p
Incorrect guess: 2


Previous guesses: fuip
Guess a character? r


Previous guesses: fuipr
Guess a character? e

- You win!

The word is frei


Write a program to play Hangman, allowing words of up to length 6. The run of the program should be something similar to that shown above:
1. Ask the user for a word.
2. Ask the player to guess a letter in the word. 3. Search for the letter in the word.
1. If it exists, print the word with the letter “revealed” and the remaining unguessed letters shown as dashes “-”. Add the letter to the previous guesses list.
2. If it doesn’t exist, add it to the previous guesses list and increment a counter. When the counter hits 10 incorrect guesses, the game ends and the player loses.
4. If the all the letters in the word are uncovered before 10 incorrect guesses, the game ends and the player wins. If more letters are to be guessed, go back to Step.2.
Your program should be modular, i.e. use functions (more than one function, and main counts as 1 function).
Your program should use arrays and/or strings to function properly.
If you want an added challenge, you can add text graphics. For example:




But you don’t have to do this.

Learning Outcomes Upon completing this assignment, students will be able to design and implement a basic program using the speci?cations provided. Students will build skills in algorithm design, program input/output, numerical calculations, basic decision statements, repetition, functions, programming style and usability.

Grading Criteria

This assignment is graded using Rubric 5. Please refer to the document “Assignment Guidelines” for detailed information on the grading criteria.NOTE: If your program does not compile, the assignment receives an automatic grade of zero. There are no regrades on a program which does not compile.

Academic Misconduct

This is an individual assignment. You may not collude with any other individual, or plagiarize their work. This course uses software to systematically inspect all solutions for possible plagiarism. Please refer to the Academic Integrity policy of the course outline.

Submission Policy

Assignments must be submitted electronically via Courselink before 11pm on the day they are due. Late assignments will not be accepted; consequently, you should aim to ?nish early, to allow for unexpected delays. Submit early and often. Each time you resubmit, your old submissions will be overwritten. There is no excuse for never having submitted an attempt.

The following is a list of items which should be considered before submitting your assignment.

Have you read the assignment guidelines?
Have you compiled your program on a lab system to make sure it works?
Have you tested the program properly?
Did you comment your code? If you don’t know whether your commenting is too much or too little, check an example in the text, or from class.
Did you include a program header?
Have you used proper style? (e.g. indented code 4 spaces, paragraphing between sections of code, whitespaces where appropriate?
Does your program have variables with good names?
Are your user prompts usable?
Does your ?le have a .c extension?
Is your program modular?
Have you tested your program to make sure it works?

Posted Date: 2/14/2013 6:44:01 AM | Location : United States

Related Discussions:- Wap for the game hangman-using functions with txt graphics, Assignment Help, Ask Question on Wap for the game hangman-using functions with txt graphics, Get Answer, Expert's Help, Wap for the game hangman-using functions with txt graphics Discussions

Write discussion on Wap for the game hangman-using functions with txt graphics
Your posts are moderated
Related Questions
Change the matrix program (program 3) slightly. Overload == operator to compare two matrices to be added or subtracted. i.e., whether the column of first and the row of second

Precedence and Order of evaluation The languages follow a standard precedence for basic operators. Precedence rules help in deleting ambiguity of the order of operations perfor

want the codings for these topic in ur experts minds.com

Differences between a pointer and a reference 1.  A reference must always point to some object where as this restriction is not imposed on a pointer. e.g. int *pi = 0;

How to write a function template A function template should be written at the beginning of the program in the global area, or you may place it into a header file. All function

A: A dangling pointer arises while you use the address of an object after its lifetime is end. It may occur in situations such as returning addresses of automatic variables from a

Default argument: When the argument is missing then the function will read the default value of the missing argument.  To make use of default argument functionality the argu

minimum of seven number

Q: In p = new Fred(), does the Fred memory "leak" if  Fred constructor throws an exception? A: No.         If an exception take place during the Fred constructor of p = new F