Вы находитесь на странице: 1из 62

2

1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. . . . . . . . . . . . . . . 6
3. . . . . . . . . . . . . 13
4. . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6. if. . . . . . . . . . . . . . . 30
7. if else if. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
8. :
. . . . . . . . . . . . . . . . . . . . . . . . 46
9.
. . . . . . . . . . . . . . . . . 49
10. switch. . . . . . . . 52
11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

1.
. , ,
, .
,
, ,
:

, .
. ,
,
(, ).
,
. ,

,
. , :
1. , , (,
). ,
(3
3), ((3)). . .
:
3

2. ,
.
+, ,* . . :
;

3. ,
.

.

.
.
, .
, , .



() [] . ->
^
! *() () ~ ++
|
%*/
&&
+
||
<< >>
?:
< > <= >=
= += = *= /= %= &= |= ^= >>= <<=
!= ==
&

4

,
, , .

2.


, .
,
.
, , ,
.

,

.

. .

,
: 5+18 23

, ,
. : 2015 5

,
: 5*10 50

, ,
. : 20/4
5


, ,
11 3, 3, (
3*3=9), 2, : 11/3 3 2
11%3 = 2 ()

:
1. ,
.
.
2.
%, . 3%10 = 3
3. ,
.
.
, ,
, ,
:
1. ++. .
:
int a=8;
cout<<a; // 8
a++;
cout<<a; // 9

2. .

. :
int a=8;
cout<<a; // 8
a--;
cout<<a; // 7

, ?!
: a=a+1 a=a-1.
, ,
, . .
5=5+1. .

. ,
,
,
;

,
( )
( ). ,
. , ,
.
1.
int a=8;
cout<<a; // 8
a++;
cout<<a; // 9
++a;
cout<<a; // 10

, .

8

. ,
, - .
2.
int a=8;
cout<<++a; // 9
cout<<a++; // 9
cout<<a; // 10

,
:
1. .
:
2.
, - ,
,
.
3. , - ,

.

() [] . ->
*/%+
<< >> & ^ |
<< = >> = ==! =
&& ||
+ ! ++
?:
+==/=*=%=&=^=|=

:
8.
cout<<++a;
, ,
, , ,
cout<<.
cout<<a++;
, ,
, , ( 9)
cout<<, a
.
cout<<a;
() ,
10.
,
, =+1 =1, ++,
10

. ,
,
? ,
:
=+12;
,
.
:

*=
=*N

A*=N

/=

A=A/N

A/=N

%=

A=A%N

A%=N

A=AN

A =N

+=

A=A+N

A+=N


,
,
.
, ,

, .

, , ,
11

, .
,
.
, , .
Game.

12

3.

1. .
//
#include <iostream>
using namespace std;
void main()
{
int buddies; //
int afterBattle; //

// . , ?
cout<<"You the pirate. How many the person in your command, without you?\n\n";
cin>>buddies;

// 10
cout<<"Suddenly you are attacked by 10 musketeers \n\n";

//10 10 .
cout<<"10 musketeers and 10 pirates perish in fight.\n\n";

//
afterBattle=1+buddies-10;

// ...
cout<<Remains only "<<afterBattle<< pirates\n\n";

// 107
cout<<"The condition killed totals 107 gold coins \n\n";

// ...
cout<<"It on "<<(107/afterBattle)<<"coins on everyone";

// -
cout<<"Pirates arrange greater fight because of remained\n\n";
//...
cout<<(107%afterBattle)<<"coins \n\n";

13



.
.
(107/afterBattle) , .
, ,
, ,
, 107
.
.
2. .
, .
Circle.
,
. ,
, .
.

14

//
#include <iostream>
using namespace std;
void main()
{

const float PI=3.141592;// -







//
float radius, circumference, area;

area=PI*radius*radius; //
circumference=PI*(radius*2); //

//
cout<<"Square of round: "<<area<<"\n\n";
cout<<"length of round: "<<circumference<<"\n\n";
cout<<"THANKS!!! BYE!!!\n\n";

//
cout<<"Welcome to program of work with rounds\n\n";
cout<<"Put the radius from rounds\n\n";
cin>>radius;
cout<<"\n\n";

15

4.
, - , , ,
. ,
, , ,
.
, ,
. . ,
, int, ,
int. ,
?
.
, , ,
.
,
. , ,
.
bool, char, short-int-unsigned int-long-unsigned
long-float-double-long double

,
, ,
, unsigned int int
,
,
4 . , ,
, , , bool,char,short,
16

int.
, ,
.
.

.
1.
, ,
, ,
. :
int A=23.5;
cout<<A; // 23

2. . ,
. .
unsigned int a=3000000000;
cout<<a; // 3000000000

3000000000 int,
unsigned int,
3000000000,
- . , int
.

17


.
,
.
1. . .
,
. .
, ,
, .
float A=23,5; - double float
-

2. . ( ). , , , .
:
double z=37.4;
float y=(int) z;
cout<<z<<*** <<y; // 37.4 ***37

(int)z
double int.
int float. ,
. z
double, ,
int .
18

.
- ,
, - .
, . :
int I=27;
short S=2;
float F=22.3;
bool B=false;

, :
I-F+S*B


? , :
int-float+short*bool

, short bool int,


:
int-float+int*int, false 0

int int , ,
int. float int, float, ,
:
-
, ,
.
19

, int float,
float.
,
float.
float res= I-F+S*B; // 27-22.3+2*0
cout<<res; // 4.7

, , , ,
, .
:
.
, , , . , int A=3; int B=2; cout<<A/B; //
1, int .
cout<<(float)A/B; // 1.5, - float.
, .
.
.
#include <iostream>
using namespace std;
void main(){

//

float digit;

cout<<"Enter digit:";

cin>>digit;





}

/* , ,
int ,
100 . */
int res=digit/100;
cout<<res<<"hundred in you digit!!!\n\n";

20

, , ,
, , c

,
. ,
.

, .

++ 11
, (, , ) .
.
int a = {11}; // a 11
int b{33};
// b 33

, {}.
.
.

?
int x = 2.88;
cout<<x; // 2

21


,
x double. ,

,
.
,
.
int x = { 2.88 }; // . 2.88 double,
x
char ch = { 777 }; // . 777 int,
ch
// 777 char

:
char ch2 = { 23 };
// . 23 char
double x = { 333 }; // 333 int double

22

5.

- , . ,
.
true, false,
.
:
1.
2.
3.
.

.
.
,
.
,

<
>
<=
>=

23

( ) , ,
, , , true,
false. :
out<<(5>3); // , (5>3) .
out<<(3<2); // 0, (3<2) .

: false true
0 1,
.
1 0,
, .
.

.

, ,
, ,
.
,
==

!=


, ,
, ,
.
24

cout<<(5!=3); // ,
(5!=3) .
out<<(3==2); // 0, (3==2) .


.

. . ,
1
10, :
> = 1 <= 10.

.

&&
||
!=

(&&)

,
.
,
. , , ,
.

25

1
true
true
false
false

2
true
false
true
false

1&& 2
true
false
false
false

, , 1 10.
#include <iostream>
using namespace std;
void main()
{

int N;

cout<<"Enter digit:\n";

cin>>N;

cout<<((N>=1)&&(N<=10));

cout<<"\n\nIf you see 1 your digit is in diapazone\n\n";

cout<<"\n\nIf you see 0 your digit is not in diapazone\n\n";
}

, ,
1, 0.
, .
(||)

,
, ,
.
, ,
, .

26

1
true
true
false
false

2
true
false
true
false

1&& 2
true
true
true
false

,
,
1 10. , .
#include <iostream>
using namespace std;
void main()
{

int N;

cout<<"Enter digit:\n";

cin>>N;

cout<<((N<1)||(N>10));

cout<<"\n\nIf you see 0 your digit is in diapazone\n\n";

cout<<"\n\nIf you see 1 your digit is not in diapazone\n\n";
}

, ( 1 10)
0, 1.
,
, .
(!)

.
,
.

27

true
false

!
false
true

// 1, (5==3) - .
cout<<!(5==3);
// 0, (3!=2) - .
out<<!(3!=2);

, , , ,
. . ,

b==0

:
!b

, b
.
, .
,
, . ,

, - , .
,
28


.
.

29

6.
if
,

. - ()

.
:
if ( )
{
1;
else
{
2;
}

if.
1. - ,
.
if(X>Y) , ,
X Y
int X=10,Y=5;
if(X>Y){ //
cout<<"Test!!!";// Test
}

30

if(A>B&&A<C) ,
, ,

int A=10,B=5,C=12;
if(A>B&&A<C){ //

cout<<"A between B and C";// A between B and C
}

if(AB) , , B, . . (
) ,
int A=10,B=15;
if(A-B){ // -5

cout<<"A != ";// A !=
}

if(++A) , , 1, . . 1
1 ,
int A=0;
if(++A){ // 1

cout<<"Best test!!";// Best test!!
}

if(A++) , , 0, . . ,
, .
int A=0;
if(A++){ // 0

cout<<"Best test!!";// , . . if
}

31

if(A==Z) , ,
A Z
if(A=Z) ,
, Z
: .
==,
=,
.
.
.
.
#include <iostream>
using namespace std;
void main(){
int A,B; //
//
cout<<"Enter first digit:\n";
cin>>A;
cout<<"Enter second digit:\n";
cin>>B;

if(B==0){ // B
cout<<"You cant divide by zero!!!";//
}
else{ //
cout<<"Result A/B="<<A<<"/"<<B<<"="<<A/B;// B
}
cout<<"\n The end. \n"; //

32

.
#include <iostream>
using namespace std;
void main(){
int A,B; //
//
cout<<"Enter first digit:\n";
cin>>A;
cout<<"Enter second digit:\n";
cin>>B;
// B ,
if(B=0){ // , . .
cout<<"You cant divide by zero!!!";
//
}
else{ // , A
/*
, . . */
cout<<"Result A/B="<<A<<"/"<<B<<"="<<A/B;
}
cout<<"\n The end. \n"; // .
}

2. ,
,
1, if,
2 else .
3. , 2, else, 1 .
4. else . , -
,
. , ,
, :

33

#include <iostream>
using namespace std;
void main(){
int A,B; //
//
cout<<"Enter first digit:\n";
cin>>A;
cout<<"Enter second digit:\n";
cin>>B;
if(B!=0){ //
cout<<"Result A/B="<<A<<"/"<<B<<"="<<A/B; //
}
//
cout<<"\nThe end.\n";
}

5. if else , .
:
#include <iostream>
using namespace std;
void main(){
int A,B; //
//
cout<<"Enter first digit:\n";
cin>>A;
cout<<"Enter second digit:\n";
cin>>B;

if(B!=0) //
cout<<"Result A/B="<<A<<"/"<<B<<"="<<A/B; //
//
cout<<"\nThe end.\n";


if .
if ,
, .
34

: : if
else !
, .
.
....
if(B==0){ // B
cout<<"You cant divide by zero!!!";//
}
cout<<"Hello";// !!!! if - else!!!
else{ //

cout<<"Result = "<<A/B;// B
}

....

.
.
, .

. if else
. ,
, .
:
?1:2;


,
1, , 2.

:

35

#include <iostream>
using namespace std;
void main(){
int A,B; //
//
cout<<"Enter first digit:\n";
cin>>A;
cout<<"Enter second digit:\n"
cin>>B;
/* , , ,

.



.*/
(B!=0)?cout<<"Result A/B="<<A<<"/!"<<B<<"="<<A/B:cout<<"You cant divide by zero!!!";

//
cout<<"\n The end. \n";

, !? ,
, . , ,
,
, .

36

#include <iostream>
using namespace std;
void main(){
int a,b; //
//
cout<<"Enter first digit:\n";
cin>>a;
cout<<"Enter second digit:\n";
cin>>b;
/*, (b>a), ?: b,
a,
, ,
max.*/
int max=(b>a)?b:a;
/*, (b<a), ?: b,
a,
, ,
min.*/
int min=(b<a)?b:a;

// .
cout<<"\n Maximum is \n"<<max;
cout<<"\n Minimum is \n"<<min<<"\n";

, :
, ,
. , , ,
if.

37

7. if else if

.
.

, . ,
100 ., 5%. 500. 10%,
, 1000 . 25%.
, ,
.
.
Discount.
1.
#include <iostream>
using namespace std;
void main(){

// ,

int summa;


//
cout<<"Enter item of summa:\n";
cin>>summa;


if(summa>100){ // 100 ., 5%

cout<<"You have 5% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*5<<"\n";

}

if(summa>500){ // 500 ., 10%

cout<<"You have 10% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*10<<"\n";

38

}
if(summa>1000){ // 1000 ., 25%
cout<<"You have 25% discount!!!\n";
cout<<"You must pay - "<<summa-summa/100*25<<"\n";
}
else{ // ,
cout<<"You have not discount!!!\n";
cout<<"You must pay - "<<summa<<"\n";
}

,
, ,
,
. , ,
5000. 1000, ,
25% . ,
.
1. if
if, ,
, if ,
.
2. , if(summa>100).
5000, 100, if. :
You have 5% discount!!!
You must pay - 4750

3. ,
if(summa>500). 5000
500,
if. :
39

You have 10% discount!!!


You must pay - 4500

4. ,
if(summa>1000), ,
5000 1000. , if, . :
You have 25% discount!!!
You must pay - 3750

, , .
. . Discount2.
2.
#include <iostream>
using namespace std;
void main(){

// ,

int summa;


//
cout<<"Enter item of summa:\n";
cin>>summa;


// 100 . 500 .,
5%

if(summa>100&&summa<=500){

cout<<"You have 5% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*5<<"\n";

}

// 500 . 1000 ., 5%

if(summa>500&&summa<=1000)

40

{

cout<<"You have 10% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*10<<"\n";

}

if(summa>1000){ // 1000 ., 25%

cout<<"You have 25% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*25<<"\n";

}

else{ // ,

cout<<"You have not discount!!!\n";

cout<<"You must pay - "<<summa<<"\n";

}
}

, ,
5000 .
1. ,
if(summa>100&&summa<=500). 5000
, if .
2 .
if(summa>500&&summa<=1000). 5000
, if
.
3. , if(summa>1000),
, 5000 1000. ,
if, . :
You have 25% discount!!!
You must pay - 3750

, -
. ,
600. ,
:

41

Enter item of summa:


600
You have 10% discount!!!
You must pay - 540
You have not discount!!!
You must pay - 600
Press any key to continue

:
1. ,
if(summa>100&&summa<=500). 5000
, if .
2 .
if(summa>500&&summa<=1000). 5000 , if ,
10% .
3. , if(summa>1000),
. if ,
if, else,
.
.
: -, , else
if. -,
, . .
Discount3.

42

3.
#include<iostream>
using namespace std;
void main(){
// ,
int summa;
//
cout<<"Enter item of summa:\n";
cin>>summa;
if(summa>1000){ // 1000 ., 25%
cout<<"You have 25% discount!!!\n";
cout<<"You must pay - "<<summa-summa/100*25<<"\n";
}
else{ // 1000 .
if(summa>500){ // 500 ., 10%
cout<<"You have 10% discount!!!\n";
cout<<"You must pay - "<<summa-summa/100*10<<"\n";
}
else{ // 500 .
if(summa>100){ // 100 ., 5%
cout<<"You have 5% discount!!!\n";
cout<<"You must pay - "<<summa-summa/100*5<<"\n";
}
else{ // 100 .
cout<<"You have not discount!!!\n";
cout<<"You must pay - "<<summa<<"\n";
}
}
}
}

,
, if, , , ,
else . , -
. ,
if else if,
. ,
, .
:
43

.
:
if else ,
. ,
if else
. , else
,
else :
#include <iostream>
using namespace std;
void main(){
// ,

int summa;

/
/
cout<<"Enter item of summa:\n";

cin>>summa;

f(summa>1000){ // 1000 ., 25%
i

cout<<"You have 25% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*25<<"\n";
}
/ 1000 .
/
else if(summa>500){ // 500 ., 10%


cout<<"You have 10% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*10<<"\n";
}
// 500 .
else if(summa>100){ // 100 ., 5%


cout<<"You have 5% discount!!!\n";

cout<<"You must pay - "<<summa-summa/100*5<<"\n";
}
else{ // 100 .


cout<<"You have not discount!!!\n";

cout<<"You must pay - "<<summa<<"\n";
}
}

44

! . , , .
,
if else.

45

8. :


, .
,
, ,
. ( ).
,
.
Quest.
.
#include <iostream>
using namespace std;
void main()
{
// . .
// .
// 3 .
cout<<"Welcome. Three tests of honour. The malicious magician has stolen\n\n";
cout<<"\nprincess and its destiny in your hands. It suggests you\n";
cout<<"\nto pass 3 tests of honour in its labyrinth.\n";

bool goldTaken, diamondsTaken, killByDragon;
// , .
cout<<"You enter into the first room, here it is a lot of gold.\n\n";
// ?
cout<<"Whether you will take it?(1-yes, 0-no)\n\n";
cin>>goldTaken;
if(goldTaken) //
{

// , . !!!

46


cout<<"Gold remains to you, but you have ruined test. GAME is over!!!\n\n";
}
else //
{

//, !

cout<<"I congratulate, you have passed the first test abuse!\n\n";

// .

cout<<"You pass in a following room. It is full of brilliants \n\n";

// ?

cout<<"Whether you will take brilliants? (1-yes,0-no)\n\n";

cin>>diamondsTaken;

if(diamondsTaken)//

{

// ,

cout<<"Brilliants remain to you, but you have ruined the second test\n\n";

// !!!

cout<<"GAME is over!!!\n\n";

}

else //

{

//, !!!

cout<<"I congratulate, you have passed the second test abuse!!!\n\n";

// .

cout<<"You enter into the third room. \n\n";

// !

cout<<"The person was attacked by a dragon! To move further \n\n";

//

cout<<"Not paying to them of attention (1-yes,0-no)?\n\n";

cin>>killByDragon;

if(killByDragon)//

{

// ,

cout<<"You try to pass past, but a dragon \n\n";

// .

cout<<"notices your presence\n\n";

//O . !!!

cout<<"It transforms you into ashes. You are dead!!!\n\n";

// !!!

cout<<"GAME is over!!!\n\n";

}

else//

{

//, !!!

cout<<"I congratulate, you with honour have was tested all!!! \n\n";

// !!!

cout<<"Princess gets to you!!!\n\n";

}

}
}
}

47

, , ,
, . ,
.

48

9.



(x0,y0). r1<r2. ,
(x, y).
, .
Circle2.


,
:
1.

,
, .
if(L>=r1&&L<=r2)
.

49

2. ,
.

.
:
.
1.
math.h.
2.
pow(double num,double exp), num , exp .
3.

sqrt(double num),
num .
c=sqrt(pow(a,2)+pow(b,2));
L=c;
3.
,
, .
a=y-y0;
b=x-x0;

.

50

#include <iostream>
#include <math.h>
using namespace std;
void main() {
/
/
i
nt x0, y0, r1, r2, x, y;
fl
oat L;
//
out<<"Input coordinates of circles center (X0, Y0):";
c
c
in>>x0>>y0;
c
out<<"Input circle radiuses R1 and R2:";
c
in>>r1>>r2;
c
out<<"Input point coordinates (X, Y): ";
c
in>>x>>y;

//

L
= sqrt(pow(x - x0, 2) + pow(y - y0, 2));
//

i
f ((r1 < L)&& (L < r2 )) {
.
cout<<"This point is situated inside the circle.\n";
}
else {

.
cout<<"This point is not situated inside the circle.\n";
}
}

51

10.

switch
,
if, . switch.
, ,
, .
, , , . .
if else if, :
# include <iostream>
using namespace std;
void main(){
//
.
float A,B,RES;
.
cout<<"Enter first digit:\n\";
.
cin>>A;
.
cout<<"Enter second digit:\n":;
.
cin>>B;
.
./
/
char key;
.
cout<<"\nSelect operator:\n;
.
cout<<"\n + - if you want to see
.
cout<<"\n - - if you want to see
.
cout<<"\n * - if you want to see
.
cout<<"\n / - if you want to see
.

SUM.\n";
DIFFERENCE.\n";
PRODUCT.\n0";
QUOTIENT.\n";

./
/
cin>>key;
.
.f(key==+) { //
i
. .
RES=A+B;
. .
cout<<"\nAnswer: "<<RES<<"\n";
.}
else if(key==-){ //
.

52

2
. .
RES=A-B;
. .
cout<<"\nAnswer: "<<RES<<"\n";
.}
else if(key==*){ //
.
. .
RES=A*B;
. .
cout<<"\nAnswer: "<<RES<<"\n";
.}
else if(key==/){ //
.
. .
if(B){ //
. .
RES=A/B;
. .
cout<<"\nAnswer: "<<RES<<"\n";
. .
}
. .
else{ //
. .
cout<<"\nError!!! Divide by null!!!!\n";
. .
}
.}
else{ //
.
. .
cout<<"\nError!!! This operator isnt correct\n";
.}
}

, .
. switch.

, , .
.
:
switch(){
case 1:

1;

break;
case 2:

2;

break;
case 3:

3;

break;
......
default:
__;


break;
}

53

:
1. , .
( char ), ,
.
2. case 1, case 2, case 3

.
3. 1, 2, 3 ,
,
case.
4. case, swith

switch.
break switch.
5. default __. default else.
,
.

54

.
# include <iostream>
using namespace std;
void main(){

//

float A,B,RES;

cout<<"Enter first digit:\n";

cin>>A;

cout<<"Enter second digit:\n";

cin>>B;

/
/
char key;

cout<<"\nSelect operator:\n";

cout<<"\n + - if you want to see

cout<<"\n - - if you want to see

cout<<"\n * - if you want to see

cout<<"\n / - if you want to see

SUM.\n";
DIFFERENCE.\n";
PRODUCT.\n";
QUOTIENT.\n";

/
/
cin>>key;


// key

switch(key){

case +:

//

RES=A+B;

cout<<"\nAnswer: "<<RES<<"\n";

break; // switch
case -:

//

RES=A-B;

cout<<"\nAnswer: "<<RES<<"\n";

break; // switch
case *:

//

RES=A*B;

cout<<"\nAnswer: "<<RES<<"\n";

break; // switch case /:

//

if(B){ //

RES=A-B;

cout<<"\nAnswer: "<<RES<<"\n";

}

else{ //

cout<<"\nError!!! Divide by null!!!!\n";

}

break; // switch
default:

//

cout<<"\nError!!! This operator isnt correct\n";

break; // switch
}
}

55

,
.
switch ,
:
1. case ,
, , .
2. default
switch,
, .
default
.
switch(){
case 1:

1;

break;
case 2:

2;

break;
default:



case


}

__;
break;
3:
3;
break;

3. (
case default) break .

56

2
switch(){
case 1:

1;

break;
case 2:

2;

break;
default:

__;

break;
case 3:

3;
}
switch(){
case 1:


1;

break;
case 2:

2;

break;
case 3:

3;

break;
default:

__;
}

4. default ,
, ,
.
switch(){
case 1:
1;

break;
case 2:
2;

break;
case 3:
3;

break;
}

5. ,

, .
, .

57

# include <iostream>
using namespace std;
void main(){
// ,

char cRate;

/
/
cout<<"Input your char-rate\n";

cin>>cRate;

/
/
switch (cRate) {

case A:

case a:

// A a 5
cout<<"Your rate is 5\n";
break;
case B:

case b:

// B b 4
cout<<"Your rate is 4\n";
break;
case C:

case c:

// C c 3
cout<<"Your rate is 3\n";
break;
case D:

case d:

// D d 2
cout<<"Your rate is 2\n";
break;
default:

//
cout<<"This rate isnt correct\n";

}
}

,
case . ,
, .
.
switch ,
,
58

, .
break case,
, ,
switch .
case, ,
.
.
# include <iostream>
using namespace std;
void main(){

//

int action;

cout<<"\nSelect action:\n";

cout<<"\n 1 - if you want to see course of dollar.\n";

cout<<"\n 2 - if you want to see course of euro.\n";

cout<<"\n 3 - if you want to see course of rub.\n";


//

cin>>action;


// action

switch(action){

case 1:

//

cout<<"\nCource: 5.2 gr.\n";

break; // switch
case 2:

//

cout<<"\nCource: 6.2 gr.\n";

//break; switch
case 3:

//

cout<<"\nCource: 0.18 gr.\n";

break; // switch
default:

//

cout<<"\nError!!! This operator isnt correct\n";

break; // switch
}
}

59

,
2 . case 2
break.
:
Select action:
1 - if you want to see course of dollar.
2 - if you want to see course of euro.
3 - if you want to see course of rub.
2
Cource: 6.2 gr.
Cource: 0.18 gr.
Press any key to continue


, case,
. ,
.
, -
.
. !

60

11.
1. , , .
2. (a<100). ,

3. , 1 2.54 . , .
.
4. ,
.

61

Вам также может понравиться