Please answer fast and please use mathlab Im using r2016b pl
Solution
please find the C# program for the hungman game.
// Program for hungman game
//including the libarary files
using system;
using System.collection.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hangman.cs.hang_man //namespace declaration
{
class HangManGame // Declaration of the class
{
//For checking the word
static bool Isword(string secreword , List<string> letter Guesses) // using ISword checking whether the entered input is string or not
{
bool word = false ; // if the eneterd data is not string then again thecondition need to executed
for (int 1=0; i<secreword.Length;i++)
{
//The index of the Secretword[i] is initialized with the C
string c = convert.Tostring(secreword[i]); //in the entered value is not string then To string will conert into string
if(letterGuessed.Contains(c))
{
// checking is that C present in the list of letters guessd
word = True;
}
/* if we found that letter C is not in the letter gussed then it semms that we dont have the full word*/
else
{
// The value od the false word will be chagned to false and value falsse will be returned
return word = false;
}
}
return word;
//Checking for thr single letter
//Is letter functionality is used
static string Isletter (string secretword , List<String> letterGuessed)
{
// here we are assuming that word that is guessed as empty
string correctletters = \" \";
//looping is done by the secret word
for( int i=0 ; i<secretword.Length ; i++) //incrementing the length of the secret word
{
Sting c=convert.Tostring(secert word[i]); // Tosting function is used to find the words
//if C is found in the list
if (letterGuessed.Contains(c))
{
// add c to correct the letters
correctletters += c; // adding the letter C in the entered word
}
else
{
// if that letter is not there then _ it will printed that particular letter not found in the secretword
correctletters += \"-\";
}
}
//after finding all the correct letters , the correcletters will be grouped together
return correctletters;
}
//usage of the alphabet to use
static void GetAlphabet (string letters)
{
List <string> alphabet = newList<string>(); // getting the string as input
for (int i=1 ; i<=26 ; i++)
{
char alpha = convert.Tochar(i+96); //converting to chracter
alphabet.Add(convert.Tostring(alpha)); // converting to the string
}
int num =49;
// for regulating the num,ber of alaphabet that are left
console.Foregroundcolor= consolecolor.red; // setting the background colour
COnsole.writeLine(\"Letters Left are:\");
for (inti=0; i<num;i++)
{
if (letters.Contains(letters))
{
alphabet.Remove(letters));
num=-1;
}
console.write(\"(\"+alphabet[i]=\")\"); //alphabet will be written
}
console.Writeline();
}



