Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Really need some help in creating a pseudocode, and flow-chart for the following program: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 {

Really need some help in creating a pseudocode, and flow-chart for the following program:

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int correctcounter = 0; int wrongcounter = 0; char l1 = 'j'; char l2 = 'a'; char l3 = 'm'; char l4 = 'e'; char l5 = 's'; char[] correctletters = { 'j', 'a', 'm', 'e', 's' }; char[] wordToReveal = { '*', '*', '*', '*', '*' }; char[] guessedletters = new char[10]; Console.WriteLine("Welcome to the Hangman Game!"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("You have 10 tries to guess the word right."); Console.WriteLine(); Console.WriteLine(); for (int i = 0; i < 10; i++) { Console.WriteLine("The word is " + string.Concat(wordToReveal) + "."); Console.WriteLine(); Console.WriteLine("Guessed letters: [{0}]", string.Join(",", guessedletters)); Console.WriteLine(); Console.WriteLine("Your total wrong guesses:{0}.", wrongcounter); Console.WriteLine(); Console.WriteLine("Please enter a letter"); Console.WriteLine(); guessedletters[i] = Convert.ToChar(Console.ReadLine()); if (guessedletters[i] == l1 || guessedletters[i] == l2 || guessedletters[i] == l3 || guessedletters[i] == l4 || guessedletters[i] == l5) { Console.WriteLine(); Console.WriteLine("You guessed correctly!"); for (int j = 0; j < correctletters.Length; j++) { if (guessedletters.Contains(correctletters[j])) { wordToReveal[j] = correctletters[j]; } } correctcounter++; } else { Console.WriteLine(); Console.WriteLine("You guessed incorrectly"); wrongcounter++; } if (correctcounter == 5) { Console.WriteLine(); Console.WriteLine("You guessed the word, [{0}]. You WIN!", string.Concat(correctletters)); break; } if (wrongcounter == 10) { Console.WriteLine(); Console.WriteLine("You LOSE! The word was [{0}]. You LOSE!", string.Concat(correctletters)); break; } } Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Please hit enter to end the program"); Console.ReadLine(); } } }

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions