Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            person Rolf = new person();
            string date = System.DateTime.Now.ToShortDateString();

            string[] tempDay = new string[3];
            int      tempAge = 0;

            tempDay = date.Split('.');

            Rolf.setName("Rolf", "Muster");
            Rolf.setBirthday(12, 8, 1990);
            tempAge = Rolf.CalcAge(Rolf.year, Convert.ToInt16(tempDay[2]));
            Rolf.setAge(tempAge);

            if (Rolf.day == Convert.ToInt16(tempDay[0]) &
                Rolf.month == Convert.ToInt16(tempDay[1]))
            {
                Console.WriteLine("Happy Birthday {0} {1} you are now {2}\n",
                                  Rolf.firstName, Rolf.familyName, Rolf.age);
            }
            else
            {
                Console.WriteLine("Sorry, today is not your birthday\n");
            }

            Console.WriteLine("Press any key to quit");

            Console.ReadKey();
        }