12.4.1. ( )
: , .
.
, . , 12.4.1.
12.4.1. .
12.4.1. y=x+3z, x z.
12.4.2.
x z. y =x+3z ( y). , , , .
12.4.2. -
y=x+3z.
12.4.2.
. .
( ).
12.4.3.
. .
, . .
.
:
( );
( );
( ).
25. :; , - . ( ). : -- ( 12.4.3.); - ( 12.4.3.); - ( 12.4.3.).
, , , , ( 12.4.3. ). , ( 12.4.3.).
12.4.3. :
) , ) , ) .
|
|
, . ( 12.4.3.) .
, ( 12.4.5).
, .
, , , .
.
26. , . ,- . ( ). : -- ( 12.4.3.); - ( 12.4.3.); - ( 12.4.3.).
, , , , ( 12.4.3. ). , ( 12.4.3.).
12.4.3. :
) , ) , ) .
, . ( 12.4.3.) .
, ( 12.4.5).
, .
, , , .
.
27. : ,. ,- . . .
:
( );
( );
( ).
12.4.6.
, p n . h (, ) : k (p<= k). , . p k (p > k) ,
|
|
12.4.6.
.
, ..
, , .
. .
28. :, . , . . .
:
( );
( );
( ).
, , ( n k p h), h.
12.4.7.
12.4.7. .
, : , . .
. , .
12.4.8.
, , . , .
. , .
12.4.8. .
29. . . ,- . . .
, . .
.
:
( );
( );
( ).
12.4.6.
, p n . h (, ) : k (p<= k). , . p k (p > k) ,
12.4.6.
.
, ..
|
|
, , .
. .
30. . . , . . 1972 Bell .. , .
1973 . UNIX . . .
1980 . - , ++. Borland C++ 3.1 , ++. *.c, ++ *.cpp. ++ 2 : Visual C++ C++ Builder, . C++ Builder Delphi, Pascal. , Windows.
( ), : ( ), [ ], { }, ! , & ( Ȼ ), | ( Ȼ), ; ( ), , , : , % , $ , ? , < > , = ( ), / \ , + , * , ^ , # , , ~ .
, (): <= ( ), >= ( ), != ( ), == , , // , , /* */ , && || Ȼ Ȼ. , , .
() : for, while, if, else, switch, case , . , () , .
( ) ,
, . , . . : , , , , . , .
|
|
, signed unsigned . signed , . , , . ( char) ( int). , , d, bd. - . - , \n .
. , , .
() enum, , enum{one=1, two=2, three=3}. 0 1, , enum{zero, one, two} 0, 1, 2. , , enum week{sunday, monday, tuesday, wednesday, thursday, friday, saturday}. week (), (sunday, 0) (saturday, 6).
31. , . . ++ ( ), ( ) ( ). , , , .
: ( , ), ( , +), ( , ~), ( !), ( , ++), ( , --), ( &, .. ), ( : , , , , , *).
: ( +), ( ), ( *), ( /, ), ( %, , 13 % 4 = 1).
, : (false, 0) (true, 0). ( , !) , .. . 1, 0, !0 = 1,!1 = 0.
( , , &&), , : 0 && 0 = 0, 0 && 1 = 0, 1 && 0 = 0, 1 && 1 = 1.
( , , ||), , : 0 || 0 = 0, 0 || 1 = 1, 1 || 0 = 1, 1 || 1 = 1.
: ( , , &, , , 20 & 12 = 4, 00010100 & 00001100 = 00000100), ( , , |, , , 20 | 12 = 28, 00010100 | 00001100 = 00011100), ( 2, ^, 0 ^ 0 = 0, 0 ^ 1 = 1, 1 ^ 0 = 1, 1 ^ 1 = 0, 20 ^ 12 = 24 00010100 ^ 00001100 = 00011000).
, , , , : ( <<, 5 << 2 = 20 00000101 << 2 = 00010100), ( >>, 5 >> 2 = 1, 00000101 >> 2 = 00000001).
|
|
, 2 , , 2 , .
( =) , , , .
++ , . , x = x + a x + = a. , && ||. x * = a x = x * a. , .
() : ( = =, ), ( !=), ( >), ( >=), ( <), ( <=).
( , a? b: c). a . a ( ), b, a ( ), c. : y = x < 0? x: x; y ( ) x.
, . : a+b, x-10*y, k/3, 6*s1+2*(a+3*b). : + ( +), ( ), * (), / (, , ), % ( , ).
, .. , , , 3/2 = 1; 1/2 = 0; 5/2 = 2. , , , . : 3./2 = 3/2. = 3./2. =1.5; 1./2 = 0.5; 5/2. = 2.5.
, , , , .. (.. ) . , math.h. , #include <math.h>. , . stdio.h, string.h. #include<stdio.h> #include<string.h>.
, 1, , , x pow(x,y) , .. .
32. , . . , , . . : <> = <>; , goto <>; .. .
, , . , . , , , , .
. , . , , .
, . . , .
: , , , , . , , . ( ).
. main . , , , ( ). .
main, . , . .
, , . , . , .
. , , (), . , . "=", :
=
, , . :
sngFirst = 10
strLastname = ""
, . :
sngResult = sngFirst + 255
strName = "" & ": " & strTeam
33. , . . , , . Visual Basic InputBox InputBox :
InputBox (prompt [, title] [, default] [, xpos] [, ypos] [, helpfile, context])
:
prompt . 1024 . Chr(13), Chr(10) ;
title ;
default . , ;
xpos . , ;
ypos
. , ;
helpfile ;
context .
Immediate :
strUserTest = InputBox (" ", " ", "****")
InputBox : Cancel. , Cancel .
(MsgBox)
MsgBox MsgBox, :
MsgBox (prompt[, buttons] [, title] [, helpfile, context])
:
prompt . 1024 . Chr(13), Chr(lO) ;
buttons ,
,
. 7.8 7.9. , 0;
title ;
helpfile ;
context .
, , .
Immediate <Enter>:
MsgBox " !", vbYesNo + vbExclamation," "
vbExclamation 48
vbQuestion 32
vbInformation 64
vbCritical 16
. .
vbOkOnly 0 OK
vbOkCancel 1 OK,
vbAbortRetryIgnore 2 , ,
vbYesNoCancel 3 , ,
vbYesNo 4 ,
vbRetryCancel 5 ,
MsgBox , . . .
,
vb0k 1
vbCancel 2
vbAbort 3
vbRetry 4
vblgnore 5
vbYes 6
vbNo 7
34. , , . . . , . ( ) . Visual Basic, , ( ), .
If
Select Case
If , , . Select case .
, If :
If...Then
If...Then...Else
If...Then , . If...Then...Else , .
, .
, True () False (). Boolean.