Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses
- system;
- var
- date: datetime;
- day, month, year: integer;
- cache: string;
- begin
- repeat
- Console.Write('Введите год (1900..2100): ');
- Cache := Console.ReadLine();
- if not TryStrToInt(Cache, Year) and not (Year in [1900..2100]) then Console.WriteLine('Ошибка: Введено не верное значение. Повторите ввод...');
- until Year in [1900..2100];
- repeat
- Console.Write('Введите месяц (1..12): ');
- Cache := Console.ReadLine();
- if not TryStrToInt(Cache, Month) and not (Month in [1..12]) then Console.WriteLine('Ошибка: Введено не верное значение. Повторите ввод...');
- until Month in [1..12];
- repeat
- Console.Write('Введите день (1..' + DateTime.DaysInMonth(Year, Month) + '): ');
- Cache := Console.ReadLine();
- if not TryStrToInt(Cache, Day) and not (Day in [1..DateTime.DaysInMonth(Year, Month)]) then Console.WriteLine('Ошибка: Введено не верное значение. Повторите ввод...');
- until Day in [1..DateTime.DaysInMonth(Year, Month)];
- Date := new DateTime(Year, Month, Day);
- Date := Date.AddDays(2);
- Console.WriteLine('Послезавтра будет: ' + Date.ToShortDateString);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement