I'm having the user input their name and then using substring to isolate the first letter. The console then prints something depending on what the first letter of the name is. How do I check what letter is being in the substring? This is what I have so far as a template.
string name,letter;
Console.WriteLine("What name would you like to use?(please enter in lower case)");
name = Console.ReadLine();
letter=name.Substring(0, 1);
if letter=a;
{Console.WriteLine("hello a");}
else
{Console.Write("alternativemessage");}
Aucun commentaire:
Enregistrer un commentaire