, .
2
, , , , , .
, . Pascal : - goto, - if - case. () .
goto
goto( ) - (), .
goto :
goto< >;
̳, , label, . 0 9999. :
Labelstart, 55, second, ;
: start, 55, second, .
, , ' , , . ,
start:S:=0;
̳ - : goto, .
, . .
, goto, , ().
goto .
2.2
- , , ,
璺 () ,
. True ()
False (), True<False.
: True False.
- , .
Boolean, :
Varp,q: Boolean;
2.1.
Odd(x) | True, - , False ; |
Eoln(f) | True, J , False- |
True, / , False- |
().
|
|
2.2.1
. true(), false() - . . 2.2.
2. 2
= | , , , , , , | = 5=5 -true 6=7 ->false | |
, , , , , , , | <> 6<>7 -true 5<>5 - false | ||
< | , , -, | a<b | |
> | , , -, | b>x | |
<= | , , , , | <= | |
>= | , , , , | s>=min 7>=5 > true 5 >=5 > true 3>=5 - false |
Boolean().
, real integer, . ANSI.
. . string, . <, >, <= >= Pchar, .
. 2.3.
2.3 -
=3 | false |
false<>true | true |
abc<abd | true |
abc>a | true |
2.2.2
- Boolean(. 2.4):
2.4
not | ( Ͳ) | Boolean | not a | |
and | Boolean | and (x>0) | ||
or | V | Δ | Boolean | a or b |
xor | Δ | Boolean | a xorb |
Delphi AND OR: . , . , True. , True , . {$-}, , , {$+}-. CompileBooleanEvaluation .
2.2.3 ()
, (.2.5):
2.5 - ()
|
|
not | Ͳ | ֳ | ֳ | not X |
and | >9 | ֳ | ֳ | and |
or | Δ | ֳ | ֳ | or |
Δ | ֳ | ֳ | ||
shl | ֳ | ֳ | shl2 | |
shr | ֳ | ֳ | shl |
, X 001101
Y100001
X or Y101101
X and Y 000001
. , not, , . and, or, , . shl shr . * 2. .
. Byte, =11, =2 , 2.6.
2.6
Not | ||
A and | ||
A or | ||
A shl | ||
A shr |
, ( 1,0) (true, false), 2.7.
2.7 -
1 | 2 | NOT | AND | OR | XOR |
1, true | - | false | |||
0, false | - | true | |||
0, false | 0, false | true | 0, false | 0, false | 0, false |
0, false | 1, true | true | 0, false | 1, true | 1, true |
1, true | 0, false | false | 0, false | 1, true | 1, true |
1,true | 1,true | false | 1, true | 1, true | 0, false |
2.1 .
→
& |
→
. , , ( ).
Δ, Ͳ , , . ' , : Ͳ ( ), Δ-Ͳ ( ) -Δ-Ͳ.
2.2.4
. .
() , 2.8.
2.8 - a
not | |
and, shl, shr | |
or, xor | |
=,<>,<,>,<=,>= |
.
, , ObjectPascal - .
: =orx=z
:
|
|
x = (yorx) = z
or , =. ϳ or = .
(+, -, *, /, div, mod) .
, 2*5<=17 div3 false, 7+3>16-4*3-true.
', = (), ' ' . 1=2
abs(al-a2)<eps,
eps- , .
, not, :
andnot2
. , , , .
. ,
1 6 4 2 5
(-3>=5) ornot(7<9) and(0<=3)
: 1 - False, 2 - True, 3 - True, 4 - False, 5 - False, 6 - False. False.
Pascal , . , IN( ), , :
:=[2,4,6,8,10];
2 in true.
5 in false.
. , .
(>=1) and(<=10),
in,
in[1...10]
.
Pascal , , .
:
if< >then<1 >else< 2>;
if(), then(), else() - ;
, 2 - .
if- , then, else . .2.2
True() ↓False()
1 |
2 |
3 |
, true, , - false, 2( 1 ). 3, f ,
X, X > 0 , <0
if>0 then:=ln(x) else:=();
- >0, 1 2 - :=1() :=().
if( else):
if< >then<1>;
. 2.3.
False, if.
. ( ): ifj:=0 then
beginShowMessage(ij );Result:=0;
end// !!!
else Result:=I/j;
1 |
True() False ()
2.3
|
|
.
, .: ifa>bthen
if> then:=1 else:=2;
, :=2,: >b , >.
: else if.
else:=2 if> then, ifa>bthen.
, , .
, , .
. :
Y =
, , .
:
if> 0 then
if>= 1 then y:=sqrt ()/2
else y:=exp(l/3*ln (x))/3 else y:=exp(l/4*ln(abs(x)))/4;
, , :
ifx<=0then y:=exp(1.4*ln(abs(x)))/4;
if (x>0) and (x<l) theny:=exp(l,3*ln(x))/3;
ifx>=ltheny:=sqrt(x)/2;
, , , .
.
2. 4
: , .
:
case <> of
<--1>: < 1>;
<--2>: < 2>;
<-->: < N>;
else < N+l> end;
case( ), of(), end() - ;
<> - , ; ;
<> - - , ;
< > - . ֳ , , . Label, goto.
䳺 . , , (). ϳ .
, N+l. Else- . , . if, else ;
,
casenomer of
2: y:=g;
4: y:=g*x;
6: y:=g*sqrt (abs(X));
end;
nomer 4, y:=g*x, , End.
.
,
casesof
+, -, *, /:p:=1;
'', b: :=2;
;: :=3;
end;
s . s +, -, *, /, 1. s '' 'b', 2. s ; 3.
.
2.5 if case
1. : [,] [c,d].
, , - .
. ShowMessage MessageDlg. ShowMessage . ShowMessage :
|
|
ShowMessage ();
' .
MessageDlg Windows, , , .
. 2.4.
a, b, c, d, x |
X [a,b] [c,d] |
ʳ |
ͳ
:
{ 䳿 " }
Procedure TForml.ButtonlClick(Sender: TObject);
Vara,b,c,d,x:Real;
begin
a:=StrToFloat(Editl.Text);
b:=StrToFloat(Edit2.Text);
c:=StrT oFloat(Edit3.Text);
d:=StrToFloat(Edit4.Text);
x:=StrT oFloat(Edit5.Text);
f (A<=x)And(x<=b)or(c<=x)and(x<=d)
thenShowMessage (' ')
elseShowMessage (' He ');
end;
2. , .
. : Odd(), true, , , 2 ( mod).
. 2.5.
N |
N- |
ʳ |
ͳ
2.5 -
:
Program project 1;
{$APPTYPE CONCOLE}
Uses sysutils;
VarN: integer;
Begin
//
Writeln();
Readln(N);
//
IfOdd(N) thenWriteln()
Else Writeln();
Readln
End.
. MSDOS. . , Windows.
, , File→New(→) NewItens( ) ConsoleWizard( ).
Delphi-5 ( ).
Program projectl;
{SAPPTYPE CONCOLE}
Uses SysUtils;
Begin
// Insert uses code here;
{ }
End.
{SAPPTYPECONCOLE} , .
Uses SysUtils.
. .
Pascal Readln ( ) Writeln ( ), .
Readln . . ϳ Enter. Readln . Enter.
Write Writeln . Write , Writeln .
Writeln , . Readln:
Begin
Readln
End
, Enter.
3. :
1) =-3,7; b=5,6; c=tg|bx|,
2) =0,81; b=-2,4; c=tg|bx|,
3) =2,5; b=0,6; c=tg|bx|
Y=
=0,5 Edit, .
. m - . Delphi , . 2.6.
:
Name - ,
Lines - ,
ScroIlBars - . : None, Vertical, Gorizontal, Both(, , , ).
:
Clear - ,
Lines.Add(s) - S .
:
{ 䳿 "" }
Procedure TForml.ButtonlClick(Sender: TObject);
Vara,b,c,d,x,y: real; s:integer; Label 88;
begin
x:= StrToFloat(Editl.Text);
s:=l;
{ }
88: case s of
1: begin a:=-3.7; b:=5.6; c:=abs(sin(b*x)/cos(b*x)); end;
2: begin a:=0.81; b:=-2.4; c:=abs(sin(b*x)/cos(b*x)); end;
3: begin a:=2.5; b:=0.6; c:=abs(sin(b*x)/cos(b*x)); end;
end;
if x<a then y:=sin(exp(a+c))+sqr(x);
if (x>=a) and (x<b) then y:=exp((l/3)*ln(a+abs(5.3*b)))+c;
if x>=b then y:=sqr(cos(a))+sin(x*x)-b*c;
// Memo
Memo1.Lines.Add(x=+ FloatToStr(x) + y= + FloatToStr(y) +IntToStr(s)+,{i - );
if s<=3 then goto 88;
end;
3.
- ?
- , .
- ( ), .
- ( ), .
- . , ?
- ?
- .
- ?
- . ?
- Z:
Z=
Y , . 2.9 , .
: , . . .
N | ||
y= | 1.u=Sin x 2.u=Cos x 3.u=tg x | |
y= | 1.a=0.4;b=2.3;z= 2.a=0.2;b=0.8;z= 3.a=0.7;b=2.1;z=0.8 | |
y= | 1.b=-1.6; m=0.9;n=-1.4 2.b=4.5;m=-0.5;n=2.2 3.b=-4.5;m=0.5;n=-1.5 | |
y= | 1.a=0.2;b=0.5;z= 2.a=0.15;b=0.2z= 3.a=0.9;b=5;z= | |
y= | 1.a=-4.2;b=5.3;c=1.5 2.a=0.35;b=-1.8;c=-1.8 3.a=2.8;b=-0.6;c=2.0 | |
y= | 1.a=-5;b=2.5z=Ln 2.a=-3;b=5;z=Ln 3.a=-10;b=3;z=Ln | |
y= | 1.a=3.2;b=-0.7;c=2.2 2.a=10.5;b=-2.5;c=5.6 3.a=5.4;b=3;c=2.6 | |
y= | 1.k=3.1;m=5.15n==0.5 2.k=0.78;m=-2.4;n=4.5 3.k=1.1;m=0.95;n=0.41 | |
y= | 1.a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