.


:




:

































 

 

 

 


. do<>while<>;




do <> while <>;

C++ , , .

.

for ([ < > ];

[ < > ];

[ < > ])

<>

for , ( 0). . , .

, , .

break;

while, do, for switch. . , . while, do, for, switch, .

.

continue;

while, do, for. . do while . for , .

return [ <> ];

, , . , . , , , , , , . , .

break, continue return . , . , . , , . , .

/ ++, , .

++ -, - , ++, -: -;

- iostream.h. #include<iostream.h> cin cout ,

cin . , x , cinx; , x , . , cinxyz;.

cout . . coutx; x.


 

1

F x. x. dx.

a,b,c

 

:

1)

:

xn x

xk x

dx

a,b,c

x

F-

: x,F

 

2)-

 

 
 

 

 


 

       
   
 
 

 

 


           
   
 
 
 
   

 

 


3) :

 

#include<iostream>

#include<iomanip>

using namespace std;

int main ()

{float x,xn,xk,dx,a,b,c;

double F;

cout<<"Vvedite xn,xk,dx,a,b,c"<<endl;

cin>>xn>>xk>>dx>>a>>b>>c;

cout<<"\n Tablitsa znacheniy x i y \n";

x=xn;

while(x<=xk)

{if(x==0 && b!=0) F=a*(x+c)*(x+c)-b; else

if(x==0 && b==0)

F=(x-a)/-c; else F=a+(x/c);

cout<<"x= "<<x<<"\t""F= "<<F<<endl;x+=dx;}

}

4) :

 

 

5):

 

2.

, , . . dx £.

1)

: x,ln,eps,MaxIter

: y,x,n

ln-

x-

y-

n-

eps-

MaxIter -

:
h*=

 

 

2)-

       
 
 
   

 


3):

#include<iostream>

#include <math.h>

#include <float.h>

using namespace std;

int main()

{

const int MaxIter=500;

double x,eps=DBL_EPSILON; int n;

cout<<"\n Vvedite znacenie x";cin>>x;

double ch=1,y=ch;

for(n=0; fabs(ch)>eps && n<MaxIter;n++)

{ch*=((x-1)*(x-1)*2*n+1)/((x+1)*(x+1)*(2*n+3));

y+=ch;}

if(n<MaxIter)

{cout<<"\n znacenie fynkcii: "<<y*2<<" dlya x="<<x<<endl;

cout<<"\n vicisleno posle "<<n<<" operacii"<<endl;}

else cout<<"\n Ryad rasxoditsya!";

}

 

4) :

 

 

5):

 
 

1.

, n :

1)

2)

3)

 

1)

: arr[i],m

: n

n-

 


2)-

                       
 
 
   
 
   
 
   
 
   
 
   

 


 
 


m:=arr[i]

             
   
 
 
 
   
 
   

       
   
 
 


 

 

:
#include <iostream>

#include <math.h>

using namespace std;

int main()

{

int n,arr[50],m=0,z,sum=0;

cout<<"Vvedite RAZMER MASSIVA: "; cin>>n;

for (int i=0; i<n; i++){

cout<<"["<<i+1<<"]: "; cin>>arr[i];

}

int min=fabs(arr[0]);

for (int i=0; i<n; i++)

if (arr[i]<0){m++;

if (fabs(arr[i])<fabs(min)){min=arr[i]; z=i;}

}

for (int i=z+1; i<n; i++){

sum+=fabs(arr[i]);

}

cout<<"OTRICATELNIH ELEMENTOV: "<<m<<endl;

cout<<"MINIMALNIY PO MODULYU: "<<min<<';'<<" EGO NOMER: "<<z<<endl;

cout<<"SUMMA MODULEY, RASPOLOJENNIH POSLE "<<min<<" RAVNA: "<<sum;

return 0;

}

 

:

 

 

 

:


01.02 , Dev-C++.

:

.

.

.

- Dev-C++, .

:

- C++;

- ;

- ;

- ;

- .


 





:


: 2016-12-28; !; : 300 |


:

:

,
==> ...

1544 - | 1419 -


© 2015-2024 lektsii.org - -

: 0.055 .