(. 4.5). - (. 4.6).
.
1 2
. 4.5. . 4.6. -
/++, , , (. 4.5).
4.5
/++ | ||||
&& | | ! | ||||
:
[ C ... Z]
, ... Z (, );
... (, ).
[ ] .
, (, );
(, ).
, , , , Z , , . (, ) ().
. , .
1 () 0 (). , && () 1, . , 0. , && (=1.2, =0.7) 1, .. . =0, 0. | | () 1, () . ( ) 0.
P if.
/++ :
;
;
;
Ȼ;
Ȼ.
() . () (). , a<b || d>k || z!=5 (a<b, d>k, z!=5), ( ) .
, , .
|
|
/++ . 4.6.
4.6
/++ | |
! a = = b | |
a>0 && c<=2 | |
b<c | | d>0 | |
0.5<x && x£7.5 |
. 4.6
/++ | |
x<=0.5 | | 7.5<x | |
x<0 && y<0 | | x>0 && y<0 | |
(a<=2 | | 3<=a) && (a<=8 | | 9<=a) | |
h= =G || h= =g || h= =ϒ || h= = |
, . . 4.7.
4.7
X | Y | N | |
x | y | n |
- , , .
- 1
- , һ, if.
:
/* 4.2. . if */
/* . 031 .. */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main()
{
float x, y;
int n;
scanf(%5f%5f, &x, &y);
printf(\n X=%7.3f Y=%8.3f\n, x, y);
if(x>0. && y>0.) /* if */
n=1; /* */
else
n=234; /* Ҕ */
printf(\n N=%3d\n, n);
}
0.0703.000 1
12.30-104. 234
-17.5-8.94
. , .
4.3 (, , ).
- 2
- һ, , if goto.
:
/* 4.2. . if */
/* . 031 .. */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main()
{
float x, y;
int n;
scanf(%5f%5f, &x, &y);
printf(\n X=%7.3f Y=%8.3f\n, x, y);
if(x>0. && y>0.) goto M1; /* if */
n=234; /* Ҕ */
goto M2;
M1: n=1; /* */
M2: printf(\n N=%3d\n, n);
}
0.0703.000 1
12.30-104. 234
-17.5-8.94
. , .
4.4 (, , ).
.
|
|
.