, () , , , , .
1. max ( min) .
max=-10E10; for(x=xn; x<=xk; x=x+h){ f=; if(f>max){ max=f; } } |
. , : max =-1010 min =1010, f>max f<min, max=f min=f.
2. S
S=0; for(x=xn; x<=xk; x=x+h){ f=; S=S+f; } cout<<S=<<S<<endl; |
3. P
P=1; for(x=xn; x<=xk; x=x+h){ f=; P=P*f; } cout<<P=<<S<<endl; |
4. S k
S=0; k=0; for(x=xn; x<=xk; x=x+h){ f=; S=S+f; k=k+1; } S=S/k; cout<<S=<<S<<endl; cout<<k=<<k<<endl; |
4. x, f f (x)=2 x +1 0≤ ≤4 1. ; , 6; .
. , , . , , , , , .
:
S ,
P , 6,
min .
.. , 6, f <6 .
, for.
- : | for: // proga26.cpp: . // #include "stdafx.h" #include <iostream> #include <iomanip> using namespace std; int main() { double x,f,S,P,min; cout<<setw(10)<<"x"<<setw(10)<<"f"<<endl; S=0; P=1; min=10E10; for(x=0; x<=4; x=x+1){ f=2*x+1; cout<<setw(10)<<x<<setw(10)<<f<<endl; S=S+f; if(f<6){ P=P*f; } if(f<min){ min=f; } } cout<<"S="<<S<<endl; cout<<"P="<<P<<endl; cout<<"min="<<min<<endl; return 0; } |
:
:
: 0, 1, 2, 3, 4.
x =0 f =2 x +1=20+1=1;
x =1 f =2 x +1=21+1=3;
x =2 f =2 x +1=22+1=5;
x =3 f =2 x +1=23+1=7;
|
|
x =4 f =2 x +1=24+1=9;
: S =1+3+5+7+9=25;
, 6: P =135=15;
: min =1.
. , , , .
5. *.
. :
*
*
*
*
*
*
*
*
*
.. , . while true: while(true). , .. . .
, . , .. . n. . , for i 1 n setw(i). , for i n 1 setw(i).
, while for , .
:
// snake.cpp: .
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int i, n;
cout<<"vvedi n=";
cin>>n;
while (true){
for(i=1; i<=n; i=i+1){
cout<<setw(i)<<"*"<<endl;
}
for(i=n; i>=1; i=i-1){
cout<<setw(i)<<"*"<<endl;
}
}
return 0;
}
: n =5:
:
, , . . , , .., .
:
1. - 1 100 .
2. y (x)=5 x 2-3 x +4 -20≤ ≤20 0,5. , .
3. - z 1=arccos3(0,05 x), z 2=0,45| x 3- x 2|+2lg2,5 x 0,8≤ ≤19 c 1. z 1, z 2, 10, z 1, z 2.
4. - 0,5≤ ≤1 c 0,05; y .
5. - Z (x,y)=min{max{sin x, sin y }, x, y } -1,7≤ ≤9,4 c 9,3; 0≤ y ≤3 c 0,75. , , , , 1 -1.
|
|
6. , . :
) , ) , ) .
, .