C# Project 2
Test out your knowledge on basic C# programming with a challenging project making a hangman game. Covers lessons 7-12 from the beginner series.
Congratulations on making it to the second and final project in the series. This one will test all of your accumulated knowledge with a focus on what you have learned in lessons 7-12. Please review the lessons if you need to. Good Luck!
Previous lesson.
We also have the source code on GitHub.
/*
* TASK:
* Make a Program that plays a game of Hangman.
* The word being guessed by the player can be hardcoded in the program. (Meaning the word is the same every time)
*
* Example Playthrough:
*
* _____
* |
* |
* |
* |___________
*
* _ _ _ _ _ _ _
*
* Guess a letter: A
* **************************
* _____
* |
* |
* |
* |___________
*
* _ a _ _ _ _ _
*
* Guess a letter: t
* **************************
* _____
* |
* |
* |
* |___________
*
* _ a t t _ _ _
*
* Guess a letter: t
* **************************
* _____
* | O
* |
* |
* |___________
*
* _ a t t _ _ _
*
* Guess a letter: x
* **************************
* _____
* | O
* | |
* |
* |___________
*
* _ a t t _ _ _
*
* Guess a letter: y
* **************************
* _____
* | \O
* | |
* |
* |___________
*
* _ a t t _ _ _
*
* Guess a letter: z
*
* I think you get where this is going.
*
* At the end of the game, ask the user if they want to play again
*
* **************************
* _____
* | \O
* | |
* |
* |___________
*
* m a t t h e w
*
* YOU WIN!
* Enter y to paly again:
*
* The player loses the game if the stick figure is completly filled out. (They had 6 incorrect guesses)
* *************************
* _____
* | \O/
* | |
* | / \
* |___________
*
* _ a t t h e w
*
* YOU LOSE!
* Enter y to paly again:
*
*/
using System;
namespace Project2
{
class Hangman
{
static void Main(string[] args)
{
}
}
}
Recommended posts
We have similar articles. Keep reading!
C# Project 1
Test out your knowledge on basic C# programming with a challenging project doing conversions. Covers lessons 1-6 from the beginner series.
C# Lesson 5
Run sections of your code only IF you want them to with the "if" statement in the 5th lesson from the series on learning C# for beginners.
C# Lesson 11
Lesson 11 in our series about learning C# teaches you about working with using boolean operators to control logic flow.
C# Lesson 1
Learn how to declare and use variables in the very first lesson from our series on learning C# for beginners.