First letter of Console.ReadLine input being cut off

  • Thread starter Thread starter The Mayday Man
  • Start date Start date
T

The Mayday Man

Guest
I am following a course, and I just finished a challenge. I ran into an issue and I want to make sure this isn't an issue with coding. Here is my code:

using System;

namespace Challenge_String_Methods_2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter a string here:");
string input = Console.ReadLine();
Console.WriteLine("Search for a character in the string:");
char search = Console.ReadLine()[0];
int searchResult = input.IndexOf(search);
Console.WriteLine(search + " is at position " + searchResult + ".");
Console.WriteLine("Press enter.");
Console.Read();
Console.WriteLine("Enter your first name.");
Console.Read();
string firstName = Console.ReadLine();
Console.WriteLine("Enter your last name.");
string lastName = Console.ReadLine();
string fullName = firstName + " " + lastName;
Console.WriteLine("Your name is " + fullName + ".");
Console.Read();
}
}
}



Here is my output:


Enter a string here:

Hello!

Search for a character in the string:

l

l is at position 2.

Press enter.


Enter your first name.

Dude

Enter your last name.

Bro

Your name is ude Bro.


Please let me know why it cuts that off!

Continue reading...
 
Back
Top