Pagini recente » Cod sursa (job #545818) | Cod sursa (job #1873803) | Cod sursa (job #521258) | Cod sursa (job #732421) | Cod sursa (job #2236337)
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
ifstream in("permutari.in");
ofstream out("permutari.out");
int main()
{
int n;
in >> n;
int myints[n];
for(int i = 1; i<=n;++i){
myints[i-1] = i;
out << myints[i-1] << " ";
}
out << endl;
while(next_permutation(myints, myints+n)){
for(int i = 0; i<n;++i){
out << myints[i] << " ";
}
out << endl;
}
}