C# Lesson 1
Learn how to declare and use variables in the very first lesson from our series on learning C# for beginners.
Author
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)
{
}
}
}
We have similar articles. Keep reading!
Learn how to declare and use variables in the very first lesson from our series on learning C# for beginners.
Author
Learn how to read input from the user in the second lesson from our series on learning C# for beginners.
Author
Learn how to do some basic math with C# in the 3rd lesson from our series for beginners learning C#.
Author