,  ,

++

> > >

 
 
TheCross84
1 / 1 / 0
: 15.03.2012
: 6
#1

stable_partition() - C++

06.04.2012, 00:33. 428. 1
( )

stable_partition()

:
, ,
,
.
,
, 1, .


:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
void main()
{
vector<double>array;
int n;
double T,sum;
int i,j;
cout<<"Vvedite razmer massiva:   ";cin>>n;
cout<<"Vvedite elementi massiva: ";
for(i=0;i<n;i++)
{
    cin>>T;
    array.push_back(T);
}
sum=0;
for(i=0;i<n;i++)
{
    if(array[i]<0)break;
}
for(j=i+1;j<n;j++) 
{
    if(array[j]<0)break;
    sum=sum+array[j];
}
cout<<"Summa                   : ";
cout<<sum<<endl;
cout<<endl;
stable_partition(array.begin(),array.end(),/* */); /*          */
for(i=0;i<n;i++) cout<<array[i]<<" ";
}
0
? .
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
06.04.2012, 00:33
! stable_partition() (C++):

!!! , ((( -
: ! SEPIC, ! , ...

!!! , ((( -
: ! SEPIC, ! , ...

!!! , ((( -
: ! SEPIC, ! , ...

!!! , ((( -
: ! SEPIC, ! , ...

!!! , ((( -
: ! SEPIC, ! , ...

!!! , ((( -
: ! SEPIC, ! , ...

!!! , ((( -
: ! SEPIC, ! , ...

!!! , ((( -
: ! SEPIC, ! , ...




:
1
OstapBender
584 / 523 / 35
: 22.03.2011
: 1,585
06.04.2012, 02:33 #2
C++
1
2
3
4
5
bool absHigher1(double val) {
return abs(val) > 1;
}
...
stable_partition(array.begin(),array.end(),func);
1

- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.