= ; = ; =
= + ; = A B; =
( , 2), X ^ X = 0. . ( ).
( ^ Y) ^ Y = ^ (Y ^ Y) = X ^ 0 = X.
, (Y ^ X) ^ Y = ( ^ Y) ^ Y = .
20. . . .
, . :
;
;
;
();
.
, , { }.
: { <1>;...; <>;}
:
{
S:=0;
Cout<<;
}
21. . . . .
. .
:
if (<>) <1>; [else <2>;]
.
:
, . : ( true), 1, 2. .
:
if ( > 0) x=x+1;
else x=0;
if (q = 0) a=1;
22. () . .
.
#include <iostream.h>
int main ()
{
int a,b,c;
cout<<"Input 3 number-->";
cin>>a>>b>>c;
int max=a;
if (b>max) max=b;
if (c>max) max=c;
cout<<"Max="<<max<<endl;
return 0;}
,
#include <iostream.h>
#include <stdlib.h>
int main ()
{
int a,b,c;
cout<<"Input 3 number-->";
cin>>a>>b>>c;
int max=(a+b+abs(a-b))/2; // max a b
max=(max+c+abs(max-c))/2; // max c max
|
|
cout<<"Max="<<max<<endl;
return 0;
}
23. () .
24. .
25. . . .
, . . .
:
switch (<->)
{
case < 1>: < 1>;
case < 2>: < 2>;
case < N>: < N>;
[default: <>;]
}
- . , . .
:
;
;
, , , .
, default ( ).
26. . .
/++ , :
goto;
break;
continue;
return.