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# Lesson 1

Learn how to declare and use variables in the very first lesson from our series on learning C# for beginners.

C# Lesson 7

You're familiar with "while" loops in C#, but but it's time to learn about "for" loops. Let's get loopy in the 7th lesson in our series about learning C#.

C# Lesson 6

Learn about "while" loops, a way to make sections of code repeat, in our 6th lesson in the C# series for beginners.

C# Lesson 10

Lesson 10 in a our series about learning C# teaches you about working with arrays.

Comments

Log in or sign up to leave a comment.