#include <iostream>
#include <string>
#include <iterator>
#include <functional>
#include <vector>
#include <cmath>
#include <ctime>
using namespace std;
int main()
{
vector<int> coll;srand(time(NULL));
class try1{
int count;
long total;
public:
try1(int a):count(0),total(a){};
void operator()(int & a){total+=a;}
long& gettotal(){return total;}
};
for(int i=0;i<1000;++i)
{
int temp=rand();
coll.push_back(temp);
}
copy(coll.begin(),coll.end(),
ostream_iterator<int>(cout," \n"));
cout << "Hello world!" << endl;
sort(coll.begin(),coll.end());
copy(coll.begin(),coll.end(),
ostream_iterator<int>(cout,"\n"));
try1 a(10);
for_each(coll.begin(),coll.end(),a);
return 0;
#include <string>
#include <iterator>
#include <functional>
#include <vector>
#include <cmath>
#include <ctime>
using namespace std;
int main()
{
vector<int> coll;srand(time(NULL));
class try1{
int count;
long total;
public:
try1(int a):count(0),total(a){};
void operator()(int & a){total+=a;}
long& gettotal(){return total;}
};
for(int i=0;i<1000;++i)
{
int temp=rand();
coll.push_back(temp);
}
copy(coll.begin(),coll.end(),
ostream_iterator<int>(cout," \n"));
cout << "Hello world!" << endl;
sort(coll.begin(),coll.end());
copy(coll.begin(),coll.end(),
ostream_iterator<int>(cout,"\n"));
try1 a(10);
for_each(coll.begin(),coll.end(),a);
return 0;
}
/
#include <iostream>
using namespace std;
void Perum(char **lis,int a,int m)
{
if(a==m)
{
for(int i=0;i<=m;++i)
cout<<lis[i]<<"--";
cout<<endl;
}
else
for(int i=a;i<=m;++i)
{swap(lis[i],lis[a]);
Perum(lis,i+1,m);
swap(lis[i],lis[a]);
}
}
int main()
{
cout<<"the size of the array string: ";
int size;
cin>>size;
char **p=new char *[size];
for(int i=0;i<size;++i)
{
char *temp=new char [100];
cin>>temp;
p[i]=temp;
}
Perum(p,0,size-1);
cout << "Hello world!" << endl;
return 0;
}