Advertisement
Alex_Fomin

Untitled

Nov 24th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.29 KB | None | 0 0
  1. uses
  2.   system;
  3.  
  4. var
  5.   date: datetime;
  6.   day, month, year: integer;
  7.   cache: string;
  8.  
  9. begin
  10.   repeat
  11.     Console.Write('Введите год (1900..2100): ');
  12.     Cache := Console.ReadLine();
  13.     if not TryStrToInt(Cache, Year) and not (Year in [1900..2100]) then Console.WriteLine('Ошибка: Введено не верное значение. Повторите ввод...');
  14.   until Year in [1900..2100];
  15.   repeat
  16.     Console.Write('Введите месяц (1..12): ');
  17.     Cache := Console.ReadLine();
  18.     if not TryStrToInt(Cache, Month) and not (Month in [1..12]) then Console.WriteLine('Ошибка: Введено не верное значение. Повторите ввод...');
  19.   until Month in [1..12];
  20.   repeat
  21.     Console.Write('Введите день (1..' + DateTime.DaysInMonth(Year, Month) + '): ');
  22.     Cache := Console.ReadLine();
  23.     if not TryStrToInt(Cache, Day) and not (Day in [1..DateTime.DaysInMonth(Year, Month)]) then Console.WriteLine('Ошибка: Введено не верное значение. Повторите ввод...');
  24.   until Day in [1..DateTime.DaysInMonth(Year, Month)];
  25.   Date := new DateTime(Year, Month, Day);
  26.   Date := Date.AddDays(2);
  27.   Console.WriteLine('Послезавтра будет: ' + Date.ToShortDateString);
  28. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement