Question
in c# need help to Modify the design and program to allow for iteration. Increase the number of guesses to 10 to solve the word.
in c# need help to Modify the design and program to allow for iteration. Increase the number of guesses to 10 to solve the word. Display the word to the user with each letter as a special character such as ********. Create an array of correct letters guessed such as: char[] guessed = new char[26];
You will need counter also to keep track of how many letters are in the guessed array. You do not need to keep track of incorrectly guessed letters
{ int score = 0; char sletter; string secretword;
Console.WriteLine("Welcome to the hangman game !"); Console.WriteLine("*****");
for (int i = 1; i <= 10; i++) { Console.Write(" Please Enter a letter: "); sletter = char.Parse(Console.ReadLine()); switch (sletter) { case 'h': Console.WriteLine("you entered correctly"); break; case 'a': Console.WriteLine("you entered correctly"); break; case 'p': Console.WriteLine("you entered correctly"); break; case 'y': Console.WriteLine(" you entered correctly"); break; default: Console.WriteLine(" you guessed incorrectly."); score++; break; } }
Console.WriteLine(" Result: \t Number of Incorrect Guesses: " + score); Console.ReadLine(); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started