Boolean

:
Ïðèìåð ==> a:=2>4 ==> False;
<> - íå ðàâíî
Ôîðìàòèðîâàíûé âûâîä:
writeln(x:5:3);

if else:
Ïðèìåð 1:if (x>y) then writeln ('÷èñëî x áîëüøå') else writeln ('÷èñëî y áîëüøå');
Ïðèìåð 2:if (x>y) then
Begin
writeln ('÷èñëî x áîëüøå');
writeln('Êàêîå íèáóäü ñîîáùåíèå');
End
else
Begin
writeln ('÷èñëî y áîëüøå');
writeln('Êàêîå íèáóäü ñîîáùåíèå');
End;
Ñòðóêòóðà èñïîëüçóåòñÿ è áåç else.
Ñîñòàâíûå óñëîâèÿ:
if ((x>y) and (z>Q)) then ....
Òàêæå âîçìîæíî èñïîëçîâàíèå èñëîâèÿ ñ îïåðàòîðàì or.
Âëîæåííûå óñëîâèÿ:
if (x>y) then
Begin
if (z>2) then writeln('ñîîáùåíèå') else writeln('ñîîáùåíèå 2');
writeln ('÷èñëî x áîëüøå');
writeln('Êàêîå íèáóäü ñîîáùåíèå');
End
else
Begin
writeln ('÷èñëî y áîëüøå');
writeln('Êàêîå íèáóäü ñîîáùåíèå');
End;
Îïåðàòîð âûáîðà Case:
Ïðèìåð:
case a of
0: writeln('Íîëü');
1: writeln('Îäèí');
2: writeln('Äâà');
else writeln('×èñëî íå ñ äèàïàçîíà îò 0 äî 2');

for i:=5 downto 1 do writeln(i).. i:=i+1.i. END..S). read(N). Îïåðòîð GOTO: uses ... 1: writeln('Îäèí'). 2: writeln('Äâà').. S:S+x. goto metka. writeln(S). Îïåðàòîð while do(Öèêë): writeln('Ââåäèòå êîëè÷åñòâî ÷èñåë'). else BEGIN writeln('×èñëî íå ñ äèàïàçîíà îò 0 äî 2'). end. while (i<=N) do BEGIN writeln('Ââåäèòå'. S:=0. s:=S+num. END.'÷èñëî'). case a of 0: writeln('Íîëü'). writeln('Ñóììà ÷èñåë:'. label metka. read(Num). Îïåðàòîð For: for i:=1 to 5 do writeln(i). repeat writeln(Ââåäèòå ÷èñëî). until (S>=10). readln(x). . Îïåðòîð REPEAT UNTIL(öèêëè÷åñêèé).end. i:=1. BEGIN metka : writeln('Ââåäèòå öèôðó'). var .

writeln(local1). Ôóíêöèè: program.. var local1:string.îêðàøèâàåò òåêñ â íóæíûé öâåò ==> êîäû öâåòîâ ñ 1 äî 15 â help. BEGIN writeln(write_funct)... Begin local1:='Òåêñò'.. . Begin write_funct:='Òåêñò'.. BEGIN write_proc. TextColor(12).. interface uses crt.. SumNum:integer. end. end. Ïðîöåäóðû: program.. procedure write_proc. Ñîçäàíèå ñîáñòâåííîãî ìîäóëÿ: unit modul. var a. Ôóíêöèÿ TextColor . ×òîáû îñóùåñòâèòü ïåðåäà÷ó äàííûõ ôóíêöèè òðåáóåòñÿ óêàçàòü íóæíûå çíà÷åíèÿ â ñêîáêàõ. END. procedure write_funct:string. END.b:integer.Òèï äàííûõ Char: Äîïóñêàåòñÿ ñðàâíèâàíèå ñòðîâ ñ äàííûì òèïîì äàííûõ òàê êàê ñðàâíåíèå èäåò ïî êîäó ñèìâîëà. uses. uses.

implementation procedure summa2(var sum: integer. begin summa1:=a+b.b:integer):integer. end.b:integer). Ìàññûâû Îäíîìåðíûå ìàñèâû: . a. end.b:integer). a. end. function summa1(a. BEGIN sum:=a+b.b:integer):integer. function summa1(a.procedure summa2(var sum: integer.

Sign up to vote on this title
UsefulNot useful