This program will is giving me the error message:
use of unassigned variable yourName and use of unassigned variable yourIsp.
If I take the for loop out it will run. I am trying to ask user for name and isp at least 4 times and create email address from first and last name using string manipulation.
static void Main(string[] args)
{
string yourName; string yourIsp;
Console.WriteLine("Enter your full name:");
for (int i = 0; i < 4; i++)
yourName = Console.ReadLine();
Console.WriteLine("Enter your ISP:");
for (int j = 0; j < 4; j++)
yourIsp = Console.ReadLine();
char[] separator = {' '};
string[] yourWords;
yourWords = yourName.Split(separator);
string yourFirstName = yourWords[0];
string yourLastName = yourWords[1];
string yourEmailAddress = yourFirstName + yourLastName + "@" + yourIsp;
yourEmailAddress = yourEmailAddress.ToLower();
Console.WriteLine("Hello {0}, your email address is {1}", yourName, yourEmailAddress);
}