Цитата:
Сообщение от MrSTEP
Да, и seson не char (символ), a string (строка)
|
Ага, а еще не описана переменная а, а еще не поставлен общий открывающий begin, а еще пропущен останов, а еще...
Ну ладно, как-то так (проверено):
Код:
program Oo;
Var
Season:STRING;
date,month,n:INTEGER;
BEGIN
WriteLn('Enter current month and date:');
Write('Month= '); ReadLn(Month);
Write('Date= '); ReadLn(Date);
Case Month of
12,1,2: Season:='winter';
3..5: Season:='spring';
6..8: Season:='summer';
9..11: Season:='autumn';
end;
Case Month of
{Number of days passed from the season beginning is equal to current date}
12,3,6,9: n:=Date-1;
{Number of days passed from the season beginning is equal to current date
plus the sum of days in previous month(s)}
1,4: n:=31+Date-1;
2: n:=31+31+Date-1;
5,8,11: n:=31+30+Date-1;
7,10: n:=30+Date-1;
end;
Writeln ('It is '+Season+' now; ',n,' days passed from the beginning.');
ReadLn;
END.
Комментарии:
1. Перешел на английский, потому что приходится прыгать между Windows и DOS, а у них разные кодировки кириллицы. Транслит же терпеть не могу.
2. Один из общих принципов написания программ: идентификаторы следует, по возможности, использовать осмысленные, а не безликие a, b, c...