Question: Create IPO Chart for the following code. static void Main(string[] args) { string word = happy; char[] array = new char[word.Length]; for (int i =

Create IPO Chart for the following code.

static void Main(string[] args) { string word = "happy"; char[] array = new char[word.Length]; for (int i = 0; i < word.Length; i++) array[i] = '*'; Console.WriteLine("Welcome to the hangman game! "); int score = 0; for (int j = 0; j < 10; j++) { Console.WriteLine(array); Console.WriteLine("Enter a letter please"); //char ch = (char) Console.Read(); string str = Console.ReadLine(); int found = 0; for (int i = 0; i < word.Length; i++) { if (str[0] == word[i]) { array[i] = word[i]; found = 1; } } if (found == 0) { Console.WriteLine("You guessed incorrectly!"); } else { // Score is used keep track of how many letters are in the guessed array score++; Console.WriteLine("You guessed a letter correctly!"); } if (word.Equals(new string(array))) { Console.WriteLine(array); Console.WriteLine("Congratulations! You have figured out the word! "); Console.ReadLine();//To keep console window open, your last line of code } } } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!