Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication21
- {
- class BirthDay
- {
- private DateTime BDay;
- // Получение дня рождения
- public void GetBDay()
- {
- Console.Write("Введите свой день рождения: ");
- BDay = Convert.ToDateTime(Console.ReadLine());
- }
- // Получение возраста
- public int ReturnAge()
- {
- return DateTime.Today.Year - BDay.Year;
- }
- // Получение кол-ва месяцев до дня рождения
- public int ReturnMonthToBDay()
- {
- if (DateTime.Today.Month < BDay.Month)
- return BDay.Month - DateTime.Today.Month;
- else
- return 12 - DateTime.Today.Month + BDay.Month;
- }
- // Поулчение кол-ва дней до ДР
- public int ReturnDaysToBDay()
- {
- int Days;
- if (DateTime.Today.Month <= BDay.Month)
- {
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- BirthDay BDay = new BirthDay();
- BDay.GetBDay();
- Console.WriteLine("Сейчас вам "+BDay.ReturnAge()+" лет. Ваш день рождения через "+BDay.ReturnMonthsToBDay()+" месяцев.");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement