1. .
x=14.26, y=-1.22, z=3.5´10-3. : h=0.749155.
2. .
x=-4.5, y=0.75´10-4, z=-0.845´102. : s=-3.23765.
3. .
x=3.74´10-2, y=-0.825, z=0.16´102. : s=1.05534.
4. .
x=0.4´104, y=-0.875, z=-0.475´10-3. : s=1.98727.
5. .
x=-15.426, y=4.642´10-2, z=21. : s=-182.038.
6. .
x=16.55´10-3, y=-2.75, z=0.15. : s=-40.6307.
7. .
x=0.1722, y=6.33, z=3.25´10-4. : s=-205.306.
8. .
x=-2.235´10-2, y=2.23, z=15.221. : s=39.3741.
9. .
x=1.825´102, y=18.225, z=-3.298´10-2. : s=1.21308.
10. .
x=3.981´10-2, y=-1.625´103, z=0.512. : s=1.26185.
11. .
x=6.251, y=0.827, z=25.001. : s=0.712122.
12. .
x=3.251, y=0.325, z=0.466´10-4. : s=4.23655.
13. .
x=17.421, y=10.365´10-3, z=0.828´105. : s=0.330564.
14. .
x=12.3´10-1, y=15.4, z=0.252´103. : s=82.8256.
15. .
x=2.444, y=0.869´10-2, z=-0.13´103. : s=-0.498707.
2
: .
if
:
If ( ) 1;
Else 2;
, 1, 2.
switch
:
switch ( ) {
case const 1: 1; break;
¼
case const N: N; break;
default: N+1;
}
switch , . case. default ( ) , .
:
:
#include <iostream.h>
#include <math.h>
int main()
{
double x,y,f,a,s;
int k;
cout << ''Vvedite x: ''; cin >> x;
cout << ''Vvedite y: ''; cin >> y;
cout << ''Viberite f: 1 sh(h), 2 x^2, 3 exp(x) ''; cin >> k;
switch (k)
{
case 1: f=sinh(x); break;
case 1: f=pow(x,2); break;
case 1: f=exp(x); break;
default: cout << ''Ne vybrana funkciya ''; return 1;
}
a=fabs(x*y);
if (a<5) {
cout << ''Net rezultata'' << endl;
return 1;
} else
If (a>10) s=fabs(f)+log(y);
Else
if (a<=10 && a>5) s=exp(f+y);
else s=sin(x)+tan(y);
cout << ''RESULT ='' << s << endl;
return 0;
}
|
|
, If. f(x): sh(x), . LabRab12.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
3
: .
for
:
for ( ; ;
)
{
}
, , .
, . 1(true), , .
, , . .
while
. :
while ();
{
}
, .
do
. :
do ();
{
}
while ();
, .
1.
. k: k=1 ; k=2 ; k=3 .. , . , . .
:
¼
s=a=1;
for (int i=1; i<101; i++)
{
a *=x/i;
s +=a;
}
2. , n=50, [-3,3], h=0.1.
#include <iostream.h>
#include <iomanip.h>
#include <math.h>
int main()
{
double a,b,h,x,y,s,p;
int n,i;
cout << ''Vvedite a,b,h,n: ''; <<endl;
cin >> a>>b>>h>>n;
x=a;
do
{
p=s=1;
for (i=1; i<=n; i++)
{
p *=log(9)*x/i;
s +=p;
}
y=pow(9,x);
cout << setw(15) << x<< setw(15) << y << setw(15) << s << endl;
x +=h;
}
while (x<=b+h/2);
cout << endl;
return 0;
}