mikroC : if () switch (). . :
1) if ;
2) if else ;
3) if else ;
4) switch .
if
if :
if ()
;
:
if ()
{
1;
..
N;
}
, . , ( , ). , ( ) .
:
char a, b;
.
if(a == 1)
b = a + 10;
.
if else
if else ( ) . .
if else :
if ()
1;
else
2;
1 2 , .
1, 2.
:
char a, b;
..
if(a == 1)
b = a + 10;
else
b= a * 3;
.
if else
mikroC if else .
if else :
if (1)
1;
else if (2)
2;
else if (N)
N;
else
(N+1);
else- if else .
if else , :
1. if- else if . .
2. . else-, .
:
char a, b;
.
if(a == 1)
b = a + 10;
else if(a == 2)
b = a * 3;
else
b = 0;
..
switch
switch ( ) . , , , .
switch:
switch ()
{
case 1:
1;
break;
case 2:
|
|
2;
break;
case N:
N;
break;
default:
(N+1);
}
switch . , switch. : 1, 2, , N. . break (), switch. , , default ( ).
switch.
1. Switch . , . switch .
2. case .
3. case, . case.
4. break . break switch. break, case.
5. , default ( ), , case . default , , switch .
6. case .
. , , case, , if else .
counter. counter 1, A 1. counter 10, B 1. counter 100, C 1. counter 1, 10. 100, D 1.
int counter, A = B = C = D = 0;
switch(counter)
{
case 1:
A = 1;
break;
case 10:
B = 1;
break;
case 100:
C = 1;
break;
default:
D = 1;
}