Split From Necro

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

30 Replies - 2463 Views - Last Post: 14 June 2013 - 03:44 AM Rate Topic: -----

#31 Witchking   User is offline

  • D.I.C Head

Reputation: 68
  • View blog
  • Posts: 189
  • Joined: 17-February 13

Re: Hangman

Posted 14 June 2013 - 03:44 AM

To use the code tags you simply use :code:.

Now, as for your problem, perhaps you could use a List, to which you add every character the player guesses, to see which ones they have already guessed, so as not to have the player accidentally guess the same one again. You could then also see if the player has guessed all of the characters in the word in question.
List<string> MyList = new List<string>();
//This is how you declare a list to hold strings.
//Unlike an array, a list's size is not constant.
//You can always add to it using
MyList.Add("Hello, world!");

You might also want to consider, do you want to make a difference between uppercase and lowercase characters? For instance if the word is "Math", does your program consider "m" or "A" to be correct, or wrong guesses?
//To change a string to all lower case you can use:
string s = "Hello";
//The string s is now "hello"

//To change a character to lowercase you can use:
char c = 'H'; //You set the value of a char using single quotes
c = char.ToLower(c);
//The char c is now 'h'

Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3