Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago