So as Many of u Know or Don't, am Learning C# and Till School Is Over My Learning Progress Will be SLOW.However, i tried to Make a Simple Program That Do Every thing this Pic Shows
[Only registered and activated users can see links. Click Here To Register...]
Now i need to Know how to make The User CHOOSE From Multi Options , like to Add [Mr , Mrs ... etc] , Emme Showed me b4 but i lost it b4 i look at it ...
[Only registered and activated users can see links. Click Here To Register...]
Now i need to Know how to make The User CHOOSE From Multi Options , like to Add [Mr , Mrs ... etc] , Emme Showed me b4 but i lost it b4 i look at it ...
Here is The Code
Code:
static void Main(string[] args)
{
StartLabel:
try
{
Console.Write("What is Your Name: ");
string Name1 = Console.ReadLine();
Console.Write("What is Your Mid Name: ");
string Name2 = Console.ReadLine();
Console.Write("What is Your Last Name: ");
string Name3 = Console.ReadLine();
Console.WriteLine("What Is Your Birth Year?");
int year = int.Parse(Console.ReadLine());
Console.WriteLine("What Is Your Birth Month? ");
int month = int.Parse(Console.ReadLine());
Console.WriteLine("What Is Your Birth Day? ");
int day = int.Parse(Console.ReadLine());
DateTime myDOB = new DateTime(year, month, day);
int age = CalcAge(myDOB);
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine("Hello" + " " + Name1 + " " + Name2 + " " + Name3 + " " +"You Are {0} Years Old.", age);
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine("Press Any Key To Close The Program ...");
Console.ReadLine();
}
catch(Exception)
{
Console.WriteLine("Invaild Input , Please Try Again . . . ");
Console.ReadLine();
goto StartLabel;
}
}
public static int CalcAge(DateTime DateOfBirth)
{
DateTime now = DateTime.Today;
int years = now.Year - DateOfBirth.Year;
if (now.DayOfYear < DateOfBirth.DayOfYear)
--years;
return years;
}
}
}