Actually the array i need to create needs to store the number of permutations 1 through 9 contains. so there are a 9 factorial possibilities i need to store. Maybe im just going about it wrong. but this is my code so far.
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int numArray[] = {1,2,3,4,5,6,7,8,9};
int *mainArray = new int[362880*9];
int a = 1;
for(int i = 0; i < 9; i++){
mainArray[0*i] = numArray;
}
while(next_permutation(numArray, numArray+9)) {
for(int i = 0; i < 9; i++) {
mainArray[a*i] = numArray;
a++;
}
}
for(int i = 0; i < 9; i++){
cout << "First " << mainArray[0*i] << endl;
cout << "Ten Thousandth: " << mainArray[10000*i] << endl;
cout << "Last " << mainArray[362880*i] << endl;
}
delete mainArray;
}
This code is what is giving me crashing problems... and i have no clue why.