TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Christina
NA
3
0
C# console hangman
Apr 9 2010 12:30 PM
Hi,
I am making a simple console hangman game. I got it to where the user can type a word, but I am having trouble getting the word and replacing it with underscores.
Example the user types family then my program get the word family and only displays _ _ _ _ _ _ on the screen for the user to start guessing the word.
Thanks Mathew, that is what I am looking for..
Here is some of my code:
{
class Program
{
static void Main(string[] args)
{
string secretWord;
Console.WriteLine("Welcome to Hangman, Let's Play.");
Console.WriteLine("");
Console.WriteLine("Please Type Your Secret Word");
Console.ForegroundColor = ConsoleColor.Black;
Console.ReadLine();
THIS IS WHERE I can't figure out how to get the user's word and change it to underscores.... Please Help
for (int i = 0; i < (secretWord.Length); i++)
{
secretWord.Replace(secretWord, ("_"));
Console.ReadLine();
}
}
}
}
The user types the secret word, then my program takes the word and only displays the underscore to equal the number of letters in that word.
Hope this helps on what I want it to do.....
Reply
Answers (
1
)
How to assign a number value to String
C# SalesPersonDemo.cs