E
Eric Anderson
Hi Guys,
I had posted awhile back that I am a new C# programmer and I have just completed my first program. It's pretty simple, but I'm having a slight problem with it. The program that I made rearranges the order of a persons name after they input it into the console. But for some reason the order of rearrangement that I set does not work the way that I want it to work. If you guys can solve my problem and tell me what I did wrong or did not do, it will be greatly appreciated. Here is my code:
using System;
namespace Name_Rearrange
{
/// <summary>
/// Name Rearranger
/// Program rearranges a persons name
/// Eric Anderson, 11.29.05
/// </summary>
class rearrange
{
static void Main(string[] args)
{
string firstname;
string middlename;
string lastname;
Console.WriteLine("Welcome to the Name Rearranger");
// Add 1 line of space here
Console.WriteLine();
Console.Write("What is your first name? ");
firstname = Console.ReadLine();
Console.Write("What is your middle name? ");
middlename = Console.ReadLine();
Console.Write("What is your last name? ");
lastname = Console.ReadLine();
// Add 1 line of space here
Console.WriteLine();
// Show rearranged name here
Console.WriteLine("{0}, {1}, {2}",firstname,middlename,lastname);
Console.WriteLine("{2}, {0}, {1}",lastname,firstname,middlename);
Console.WriteLine("{2}, {1}, {0}", lastname, middlename, firstname);
// Add 1 line of space here
Console.WriteLine();
// Ask to press enter to end
Console.WriteLine("Thank you for playing");
Console.Write("Please press the enter key to exit!");
Console.ReadLine();
}// End Main
}// End Class
}// End Namespace
I had posted awhile back that I am a new C# programmer and I have just completed my first program. It's pretty simple, but I'm having a slight problem with it. The program that I made rearranges the order of a persons name after they input it into the console. But for some reason the order of rearrangement that I set does not work the way that I want it to work. If you guys can solve my problem and tell me what I did wrong or did not do, it will be greatly appreciated. Here is my code:
using System;
namespace Name_Rearrange
{
/// <summary>
/// Name Rearranger
/// Program rearranges a persons name
/// Eric Anderson, 11.29.05
/// </summary>
class rearrange
{
static void Main(string[] args)
{
string firstname;
string middlename;
string lastname;
Console.WriteLine("Welcome to the Name Rearranger");
// Add 1 line of space here
Console.WriteLine();
Console.Write("What is your first name? ");
firstname = Console.ReadLine();
Console.Write("What is your middle name? ");
middlename = Console.ReadLine();
Console.Write("What is your last name? ");
lastname = Console.ReadLine();
// Add 1 line of space here
Console.WriteLine();
// Show rearranged name here
Console.WriteLine("{0}, {1}, {2}",firstname,middlename,lastname);
Console.WriteLine("{2}, {0}, {1}",lastname,firstname,middlename);
Console.WriteLine("{2}, {1}, {0}", lastname, middlename, firstname);
// Add 1 line of space here
Console.WriteLine();
// Ask to press enter to end
Console.WriteLine("Thank you for playing");
Console.Write("Please press the enter key to exit!");
Console.ReadLine();
}// End Main
}// End Class
}// End Namespace