ok so far i got this!!! but what i realized is that when i run the ouput 1 2 3 4 5 it gives me the correct output but if i put the value as 3 6 7 8 4 !!! it arranges the number as 3 4 6 7 8 in the ascending order!! i want the next permutatioin to be like

3 6 7 8 4

3 6 8 4 7

3 6 8 7 4

and so on .... plz help me out!!tell me where i am doing wrong ?or can anyone help me to do without defnining 5 number!!! or asking user to enter as many number as they want and giving the next permutation!! thank you

#include <iostream>

#include <algorithm>

#include <iomanip>

#define s 5

using namespace std;

int main () {

double g;

cout << "Input "<<s<<" Numbers : ";

int per[s];

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

{

cin>>per*;
}
int size = sizeof per/sizeof(int);*

sort (per,per+size);

do {

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

{

cout << per* << " ";
}
cout<<endl;
} while ( next_permutation (per,per+size) );*

return 0;

}