.


:




:

































 

 

 

 


Inmatr ( matr, rows, cols);




//

Srcols (matr, rows, cols);

Return 0;

}

5.2.3

() . , , .

- , , ' , .

 

5.4 c ( =10-3 ).

 

// P5_4.CPP

//

#include <math.h>

#include < iostream >

Using namespace std;

const float e =1 e-3;

float fn1 (float x) // 1-

{

return sgrt (1 +log (x));

}

float fn2 (float x) // 2-

{

return log (1 +pow (x,2)) / (1+pow (x,2));

}

float ft (int n, float a,float b, float fun(float)) //

{

Int i;

float s1,h, s=0;

Do

{ s1 =s;

h = (b -a) /n;

s = (fun (a) +fun (b)) / 2;

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

s += fun (a + i *h);

s *= h; n *= 2;

} while (fabs (s-s1) > e);

return s; }

Int main ()

{

Float y;

y = ft (20, 2, 2, 3.0, fn1) +ft (20, 0, 1.0, fn2);

cout << "y=" << y << endl;

Return 0;

}

:

y = 1.29012

5.2.4

' . , ( ). , , , return. . , :

Double sgr (double);

Main()

{

cout << " =" << sgr (10) << endl;

}

Double sqr (double p)

//

{

return p*p;

}

:

= 100.

return . , , , , , .

' ¾ - , ( ) . , . "*", , .

5.5 x , a, b c .

// P5_5.CPP ¾

//

// " "

#include < iostream >

Using namespace std;

float ur (float x, float =0., floatb b =0.,float c=0.);

Int main ()

{

float =1., b = 2., c = 3., x = 0.5, y;

cout << " " << endl;

y = ur (x, a, b, c);

cout << " y = "<< y << endl;

cout << " x, a, b " << endl;

y =ur (x, a, b);

cout << " y = "<< y << endl;

cout << " x " << endl;

y =ur (x);

cout << " y = "<< y << endl;

}

//





:


: 2015-11-05; !; : 317 |


:

:

, , .
==> ...

1951 - | 1611 -


© 2015-2024 lektsii.org - -

: 0.013 .