I am making a hangman in C# by my own and so far i am doing good. The game works but the letters organize depending on the users input and i want to erase the " _ " from the character everytime the word is found and is on the text.
This is how it looks on the game :

As you can see , the "_" only disapears for the first letter but not for the others and if the users put the correct answer correctly but radomly some words stick together in many cases and do not stay on their places. This my code for the game:
string word;
char letter_inserted;
int correctanswer, incorrectanswer;
int counter = 0;
correctanswer = 5;
Console.WriteLine("welcome to the game of hangman");
Console.Write("First player please introduce the secret word: ");
word = Console.ReadLine();
Char[] sentenceChar = word.ToCharArray();
Console.WriteLine("Second player you can already play.");
foreach( char letter in senteceChar)
{
Console.Write(" _ ");
}
Console.WriteLine("\n");
Console.WriteLine("{0} correcct answers are allowed. \n",correctanswers); //lives
Char[] correctletter = new Char[5];
for (int i = 1; i > 0; i++)
{
Console.Write("\n\nWhat letter you want to play : ");
letter_inserted = Convert.ToChar(Console.ReadLine());
for (int j = 0; j < sentenceChar.Length; j++)
{
if (sentenceChar[j] != letter_inserted)
{
incorrectanswer = correctanswer - 1; //lives
Console.Write(correctletter[j] + " _ ");
}
if (sentenceChar[j] == letter_inserted)
{
correctletter[j] += sentnceChar[j]; //inserting the correct word
Console.Write(correctletter[j]);
}
}
}
Console.ReadKey();
}
for (int i = 1; i > 0; i++). I'm not sure about the exact rules of hangman but didn't you have exact numbers of guess to find out the word after which you are supposed to lose the game?