. , . , . 4. , . , . 0. , 1, .
++ , , , bool true false.
4.
> | |
>= | |
< | |
<= | |
!= | |
&& | |
|| | |
! |
, . , 10 > 1+12 , : 10 > (1+12).
, /++ . , , , , , , , char int. 5.
5.
& | |
| | |
^ | |
~ | () |
>> | |
<< |
1. , .
2. ?
3. .
4. *.cpp ?
5. ++.
6. ++?
7. ++?
8. . ++.
9. ++ :
20 20.0
20.0 21
11. ++?
2
++
:
1. ++;
2. Microsoft Visual C++ 5.0.
:
- , IBM PC.
:
- Windows;
|
|
- Microsoft Visual C++ 5.0.
1.1. Microsoft Visual C++ 5.0;
1.2. , Microsoft Visual C++ 5.0;
1.3. ;
1.4. .
2.1. ( );
2.2. Microsoft Visual C++ 5.0;
2.3. *.cpp ;
2.4. ;
2.5. ;
2.6. Microsoft Visual C++ 5.0 .
3.1. .
3.2. .
3.3. .
3.4. .
3.5. .
3.6. .
, , , . ++ :
Ø ( if switch);
Ø (for, while, do while);
Ø (break, continue, return, goto);
Ø ( " ", ).
. , . C/C++, , ";".
, , . .
:
++ i;
, i .
a=cos(b*5);
, , .
Fun(x,y);
, .
";". .
, . . .
if
:
if () 1 ;
else 2 ;
if . :
- (.. 0), 1;
- (.. 0), 2;
- 2 ( ), if .
|
|
if:
Char sign;
Int x,y,z;
....
if (sign == -)
x = y - z;
else if (sign == +)
x = y + z;
else if (sign == *)
x = y * z;
else if (ZNAC == /)
x = y / z;
Else
x=0;
if, if else. if . else if, else.
if (i)
{
if(j) 1;
if(k) 2; /* if */
else 3; /* else */
}
else 4; /* if (i) */
else if(j), , if (i). else if(k), if .
switch
switch .
:
Switch ()
{ [ ]
:
[ case -1]: [ -1 ]
[ case -2]: [ -2 ]
:
:
:
[ default: [ ]]
}
, switch , , C/C++, . , . .
switch . , case, , , , default. , . switch .
switch :
- ;
- , case;
- , , case;
- , , default, switch .
, , case.
:
int i=2;
Switch (i)
{
case 1: i += 2;
case 2: i *= 3;
case 0: i /= 2;
case 4: i -= 5;
default:;
}
switch , case switch , .
break
break switch, do, for, while. break , .
exit () , . exit () .
exit () .
void exit (int _);
_ , .
continue
continue, break, , , , .
|
|
:
Int main()
{
Int a,b;
for (a=1,b=0; a<100; b+=a,a++)
{
if (b%2) continue;
... /* */
}
Return 0;
}
1 , continue for, . continue, break, .
return
return , , , , . main .
:
return [];
, , . , .
- return, . . , void. , return , .
:
Int sum (int a, int b)
{
return (a+b);
}
sum a b int, int, , . return .
: