//Program tested on Microsoft Visual Studio 2008 - Zahid Ghadialy
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main()
{
string someString="ABC";
vector<string> someVector;
someVector.push_back(someString);
string::iterator itBegin = someString.begin();
string::iterator itEnd = someString.end();
while(next_permutation(itBegin, itEnd)) //std::next_permutation defined in algorithm
{
someVector.push_back(string(itBegin, itEnd));
}
copy(someVector.begin(), someVector.end(), ostream_iterator<string>(cout, "\n"));
return 0;
}
The output is as follows:
sir please have a look at my prog:
ReplyDelete#include
using namespace std;
int main()
{
int a=6,b=2;
cout<<"original:"<<endl<<"a="<<a<<endl<<"b="<<b<<endl;
a-=(b=(a+=b)-b);
cout<<"new values:"<<endl<<"a="<<a<<endl<<"b="<<b;
getchar();
return 0;
}
Not sure, what I should be looking at?
ReplyDeleteDid you intend to leave this comment at the post here ?
yes sir...i mistakenly posted it here..
ReplyDelete