Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
harold aptroot27-Oct-20 0:45
harold aptroot27-Oct-20 0:45 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff27-Oct-20 5:46
professionalBillWoodruff27-Oct-20 5:46 
QuestionHow to allow numbers and special characters in a textBox in C#? Pin
Alex Dunlop25-Oct-20 5:51
Alex Dunlop25-Oct-20 5:51 
AnswerRe: How to allow numbers and special characters in a textBox in C#? Pin
Richard MacCutchan25-Oct-20 6:19
mveRichard MacCutchan25-Oct-20 6:19 
GeneralRe: How to allow numbers and special characters in a textBox in C#? Pin
Alex Dunlop25-Oct-20 7:00
Alex Dunlop25-Oct-20 7:00 
GeneralRe: How to allow numbers and special characters in a textBox in C#? Pin
Richard MacCutchan25-Oct-20 7:13
mveRichard MacCutchan25-Oct-20 7:13 
AnswerRe: How to allow numbers and special characters in a textBox in C#? Pin
BillWoodruff25-Oct-20 21:58
professionalBillWoodruff25-Oct-20 21:58 
QuestionHi guys, currently making a guessing game and need some help with my code.. Pin
Member 1497438624-Oct-20 12:53
Member 1497438624-Oct-20 12:53 
At the moment the program will only reveal a letter if the users input matches the specified letter within the iteration.

What I would like to do is reveal a letter despite what iteration the user is on...e.g. if the user inputs "P" on the first iteration I want the program to reveal all the Ps" in happy.

Thanks!


C#
{
           
            string[] secret = { "h", "a", "p", "p", "y" };
            string[] hidden = { "_", "_", "_", "_", "_" };
            string letter = "";

            Console.WriteLine("Welcome to guess a word game");

            for (int i = 0; i < secret.Length; i++)
            {            
                Console.WriteLine("Guess a letter: ");
                letter = Console.ReadLine();

                //revealing letters
                if (secret[i]  == letter)
                {
                    hidden[i] = letter;
                }
                //displaying the word to the user after each guess
                foreach (string k in hidden)
                {
                    Console.Write(k.ToString());                  
                }
                Console.WriteLine();
            }
            Console.WriteLine();
         
            // once broken out of the for loop it will inform the user if they have guessed the word correctly.
            if(secret == hidden)
            {
                Console.WriteLine("You have guessed the correct word!");
            }
            else
            {
                Console.WriteLine("unfortunately you have not gussed the correct word");
            }
            Console.ReadLine();
        }
    }
}

AnswerRe: Hi guys, currently making a guessing game and need some help with my code.. Pin
BillWoodruff24-Oct-20 15:04
professionalBillWoodruff24-Oct-20 15:04 
GeneralMessage Closed Pin
22-Oct-20 21:58
Osman Bur22-Oct-20 21:58 
GeneralRe: Kayan Yazı Pin
CHill6022-Oct-20 22:09
mveCHill6022-Oct-20 22:09 
GeneralRe: Kayan Yazı Pin
OriginalGriff22-Oct-20 22:14
mveOriginalGriff22-Oct-20 22:14 
QuestionInconveniente con la función MesageBox en C# Pin
Hernán Camilo21-Oct-20 8:50
professionalHernán Camilo21-Oct-20 8:50 
AnswerRe: Inconveniente con la función MesageBox en C# Pin
Richard MacCutchan21-Oct-20 22:02
mveRichard MacCutchan21-Oct-20 22:02 
GeneralRe: Inconveniente con la función MesageBox en C# Pin
jsc4222-Oct-20 23:28
professionaljsc4222-Oct-20 23:28 
GeneralRe: Inconveniente con la función MesageBox en C# Pin
Richard MacCutchan22-Oct-20 23:54
mveRichard MacCutchan22-Oct-20 23:54 
AnswerRe: Inconveniente con la función MesageBox en C# Pin
OriginalGriff23-Oct-20 1:13
mveOriginalGriff23-Oct-20 1:13 
QuestionApertura de Archivos en C# ASP.Net interactuando con base de datos SQL Server Pin
Hernán Camilo21-Oct-20 8:50
professionalHernán Camilo21-Oct-20 8:50 
AnswerRe: Apertura de Archivos en C# ASP.Net interactuando con base de datos SQL Server Pin
BillWoodruff21-Oct-20 15:30
professionalBillWoodruff21-Oct-20 15:30 
QuestionGhost click mouse Pin
cloude8317-Oct-20 1:54
cloude8317-Oct-20 1:54 
AnswerRe: Ghost click mouse Pin
OriginalGriff17-Oct-20 2:16
mveOriginalGriff17-Oct-20 2:16 
GeneralRe: Ghost click mouse Pin
cloude8317-Oct-20 11:01
cloude8317-Oct-20 11:01 
AnswerRe: Ghost click mouse Pin
jsc4219-Oct-20 23:03
professionaljsc4219-Oct-20 23:03 
GeneralRe: Ghost click mouse Pin
trønderen20-Oct-20 5:54
trønderen20-Oct-20 5:54 
Questionhi im a bit stuck i followed this tut on youtube and its just not working can anyone help me plz i get error Pin
Marcus Riggs14-Oct-20 12:32
Marcus Riggs14-Oct-20 12:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.