Posted by: alece September 25, 2011
Login in to Rate this Post:
0
?
this is how i did!! and it works too!!! but my professor doesnt want me to define a specific number like 5 i did in the program!!! and he doesnt want me to use the std library too!!!how can i make the user input any size of the number user wants!!!and he wants me to do using own algorithm and use swap and other methods!! help me if u can !!!
#include
#include
#include
#define s 5
using namespace std;
int main () {
cout << "Input "< int per[s];
for (int i=0; i {
cin>>per[i];
}
int size = sizeof per/sizeof(int);
(per,per+size);
do {
for (int i=0; i {
cout << per[i] << " ";
}
cout< } while ( next_permutation (per,per+size) );
return 0;
}
#include
#include
#include
#define s 5
using namespace std;
int main () {
cout << "Input "<
for (int i=0; i
cin>>per[i];
}
int size = sizeof per/sizeof(int);
(per,per+size);
do {
for (int i=0; i
cout << per[i] << " ";
}
cout<
return 0;
}