: , switch break, goto.
. -, :
switch ()
{ case 1: _1;
case 2: _2;
.................
default: ;
}
: switch, case, default. -. case . ( ). default . , switch, , case. , . - (.. goto, return, exit(), break), , .
default , switch case. default . . , default, ( ). , default "case " . , , goto.
break. ( ) .
, ( for while) ( do), . :
{
if () break;
}
:
while(1)
{
printf ("\n n=);
scanf("%d",&n);
if(n > 0) break;
printf ("\n ! n >0!\n);
}
continue. continue. continue break. , for while. , . continue , , .. . .
|
|
. , , . :
#include <stdio.h>
/* */
void main()
{
double s,x;/*x - , s - */
int k; /*k - */
printf("\n "
" 0 :\n");
for(=1.0, s=0.0, k=0; x!> 0.0;)
{
scanf("%lf",&x);
if( <= 0.0) continue;
k++;s+=x;
}
printf("\n Cya=%f,
=%<d" rs,k);
}
:
0 :
-3.0 14.0 -5 -4 10 0.0
=30.000000, =3
, . , , . printf().
1 , , , ( ifelse, switch, break, goto, (?:) - ).
2 .
3 , .
4 .
5 , .
case, .
mn.
x [,]. 1,2,3,4 f1,f2,f3,f4 17,18.
17
m | X | X | X1 | X2 | X3 | X4 |
-10 | [6,12] | [6,12] | [-2,5] | |||
[10,20] | [10,20] | [1,8] | ||||
, 3 [10,20] | , 3 [10,20] | [2,5] [21,24] |
18
n | f1(x) | f2(x) | f3(x) | f4(x) |
px2+sinx | 10x3-tg(x/5) | cospx | e-x/4 | |
ln2(x2+1,5) | e-2x | sinpx | arctg(3x) | |
e2x-5 | cos2(px) | ln(x2+2,5) | arcsin(x/30 | |
arccos(x/35) | e2x-10 | ln2(3x+1) | sin(2px) | |
e-x/10 | arctg(4x) | |8x3-20| | ||
tg2(x/5) | 2sin(x/p) | ex+2 | ||
e2x-15 | ln|x+1,5| | sin3(x2) | ||
5e-x | sin(px2/2) | arctg(x/3) | ||
psin(px/3) | ex/10+2 | cos2|x| | ||
ln(x3+1,8) | sin(3x+p) | x2+5x |
9