.


:




:

































 

 

 

 





.

:

 

1=2, 2=4, b1=-1, b2=6,

 

:

1: 2

b1: 4

2: -1

b2: 6

2x+4<0

-1x+6<0

: X<-1.5


9

 

- . .

 

. ++.

 

, . (function overloading) , () . , , . , . , . , .

, - . , , , . , , , . , - .

, , .. . , int, long, float, double. .

. , () , () .

.

.

 

:

#include <iostream.h>

int max_element (int n, int a[ ])

// int

{

int max=a[0];

for (i=1; i<n; i++)

if (a[i]>max) max=a[i];

return max;

}

 

long max_element (int n, long a[ ])

// long

{

long max=a[0];

for (i=1; i<n; i++)

if (a[i]>max) max=a[i];

return max;

}

double max_element (int n, double a[ ])

// double

{

double max=a[0];

for (i=1; i<n; i++)

if (a[i]>max) max=a[i];

return max;

}

 

float max_element (int n, float a[ ])

// float

{

float max=a[0];

for (i=1; i<n; i++)

if (a[i]>max) max=a[i];

return max;

}

 

void main ()

{

int x[]={10, 20, 30, 40, 50, 60};

long y[]={12, 44, 22, 37,30};

......

int m1=max_element(6, x);

long m2=max_element(5, y);

.....

}

 

 

, .

 

1.

) ;

) .

 

2.

) ;

) .

 

3.

) ;

) .

 

4.

) ;

)

.

 

5.

) ;

) .

 

6.

) ;

) .

 

7.

) ;

) .

 

8.

) .

) .

 

9.

) ;

) .

 

10.

) ;

) .

 

11.

) ;

) .

 

12.

) ;

) .

 

13.

) ;

) .

 

14.

) ;

) ;

) .

 

15.

) [1] n;

) ( n).

 

16 .

)

) ()

 

17.

) ;

) () , .

 

18.

) ;

) .

 

19.

) ;

) .

 

20.

) ;

) , .

 

21.

) ;

) , .

 

22.

) ;

) .

 

23.

) .

) .

 

24.

) ;

) .

 

25.

) ;

) ;





:


: 2016-11-02; !; : 765 |


:

:

, .
==> ...

1701 - | 1510 -


© 2015-2024 lektsii.org - -

: 0.021 .