Thanks Master...... Wow, I sound like a Kung Fu dub. Being a bud of a master actually gives me some confindence. It sounds sarcastic but I'm serious. I guess my mum was right I really should have fixed up. If I did I wouldn't be single now. Anyways, please forgive me for this and notice that this time the lowest number is 0 and not 1.
[code]
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;
int main () {
int P [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int ka [56] = {};
int L, H, z, f, y, x, p, k, a, c;
string line;
z=10; p = 0;
ofstream myfile ("Factorial.txt"); if (myfile.is_open())
cout << "Please type the the highest number: ";cin >> L; ++L;
loop: y=z; while (P [z] != L) {
H = 0; a = z; c = (z-1); f = 55;
ka[1] = (P[1]-P[0]);
ka[2] = (P[2]-P[0]);
ka[3] = (P[3]-P[0]);
ka[4] = (P[4]-P[0]);
ka[5] = (P[5]-P[0]);
ka[6] = (P[6]-P[0]);
ka[7] = (P[7]-P[0]);
ka[8] = (P[8]-P[0]);
ka[9] = (P[9]-P[0]);
ka[10] = (P[10]-P[0]);
ka[11] = (P[2]-P[1]);
ka[12] = (P[3]-P[1]);
ka[13] = (P[4]-P[1]);
ka[14] = (P[5]-P[1]);
ka[15] = (P[6]-P[1]);
ka[16] = (P[7]-P[1]);
ka[17] = (P[8]-P[1]);
ka[18] = (P[9]-P[1]);
ka[19] = (P[10]-P[1]);
ka[20] = (P[3]-P[2]);
ka[21] = (P[4]-P[2]);
ka[22] = (P[5]-P[2]);
ka[23] = (P[6]-P[2]);
ka[24] = (P[7]-P[2]);
ka[25] = (P[8]-P[2]);
ka[26] = (P[9]-P[2]);
ka[27] = (P[10]-P[2]);
ka[28] = (P[4]-P[3]);
ka[29] = (P[5]-P[3]);
ka[30] = (P[6]-P[3]);
ka[31] = (P[7]-P[3]);
ka[32] = (P[8]-P[3]);
ka[33] = (P[9]-P[3]);
ka[34] = (P[10]-P[3]);
ka[35] = (P[5]-P[4]);
ka[36] = (P[6]-P[4]);
ka[37] = (P[7]-P[4]);
ka[38] = (P[8]-P[4]);
ka[39] = (P[9]-P[4]);
ka[40] = (P[10]-P[4]);
ka[41] = (P[6]-P[5]);
ka[42] = (P[7]-P[5]);
ka[43] = (P[8]-P[5]);
ka[44] = (P[9]-P[5]);
ka[45] = (P[10]-P[5]);
ka[46] = (P[7]-P[6]);
ka[47] = (P[8]-P[6]);
ka[48] = (P[9]-P[6]);
ka[49] = (P[10]-P[6]);
ka[50] = (P[8]-P[7]);
ka[51] = (P[9]-P[7]);
ka[52] = (P[10]-P[7]);
ka[53] = (P[9]-P[8]);
ka[54] = (P[10]-P[8]);
ka[55] = (P[10]-P[9]);
while ( ka[f] != 0 ) { if (ka[f] == 0) {++H, --f;} else --f; }
while ( c != -1) { if (P[a] <= P[c]) {++H, --a, --c;} else {--a, --c;} }
if (H == 0) {myfile << P[0] << "\t" << P[1] << "\t" << P[2] << "\t" << P[3] << "\t" << P[4] << "\t" << P[5] << "\t" << P[6] << "\t" << P[7] << "\t" << P[8] << "\t" << P[9] << "\t" << P[10] << "\n";};
if (k != 0) {++P [z], p = 0;} else p = 0; }; while (y != 0)
if ( P [y] != L) goto endloop; else P [y]=0, --y, ++P [y]; goto endloop;
endloop: while (P[0] != L) {goto loop;} myfile.close(); return 0;}
[\code]
The problem shows here. If I enter 12 this happens
Code:
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 11
0 1 2 3 4 5 6 7 8 9 12
0 1 2 3 4 5 6 7 8 10 11
0 1 2 3 4 5 6 7 8 10 12
0 1 2 3 4 5 6 7 8 11 12
0 1 2 3 4 5 6 7 9 10 11
0 1 2 3 4 5 6 7 9 10 12
0 1 2 3 4 5 6 7 9 11 12
0 1 2 3 4 5 6 7 10 11 12
0 1 2 3 4 5 6 8 9 10 11
0 1 2 3 4 5 6 8 9 10 12
0 1 2 3 4 5 6 8 9 11 12
0 1 2 3 4 5 6 8 10 11 12
0 1 2 3 4 5 6 9 10 11 12
0 1 2 3 4 5 7 8 9 10 11
0 1 2 3 4 5 7 8 9 10 12
0 1 2 3 4 5 7 8 9 11 12
0 1 2 3 4 5 7 8 10 11 12
0 1 2 3 4 5 7 9 10 11 12
0 1 2 3 4 5 8 9 10 11 12
0 1 2 3 4 6 7 8 9 10 11
0 1 2 3 4 6 7 8 9 10 12
0 1 2 3 4 6 7 8 9 11 12
0 1 2 3 4 6 7 8 10 11 12
0 1 2 3 4 6 7 9 10 11 12
0 1 2 3 4 6 8 9 10 11 12
0 1 2 3 4 7 8 9 10 11 12
0 1 2 3 5 6 7 8 9 10 11
0 1 2 3 5 6 7 8 9 10 12
0 1 2 3 5 6 7 8 9 11 12
0 1 2 3 5 6 7 8 10 11 12
0 1 2 3 5 6 7 9 10 11 12
0 1 2 3 5 6 8 9 10 11 12
0 1 2 3 5 7 8 9 10 11 12
0 1 2 3 6 7 8 9 10 11 12
0 1 2 4 5 6 7 8 9 10 11
0 1 2 4 5 6 7 8 9 10 12
0 1 2 4 5 6 7 8 9 11 12
0 1 2 4 5 6 7 8 10 11 12
0 1 2 4 5 6 7 9 10 11 12
0 1 2 4 5 6 8 9 10 11 12
0 1 2 4 5 7 8 9 10 11 12
0 1 2 4 6 7 8 9 10 11 12
0 1 2 5 6 7 8 9 10 11 12
0 1 3 4 5 6 7 8 9 10 11
0 1 3 4 5 6 7 8 9 10 12
0 1 3 4 5 6 7 8 9 11 12
0 1 3 4 5 6 7 8 10 11 12
0 1 3 4 5 6 7 9 10 11 12
0 1 3 4 5 6 8 9 10 11 12
0 1 3 4 5 7 8 9 10 11 12
0 1 3 4 6 7 8 9 10 11 12
0 1 3 5 6 7 8 9 10 11 12
0 1 4 5 6 7 8 9 10 11 12
0 2 3 4 5 6 7 8 9 10 11
0 2 3 4 5 6 7 8 9 10 12
0 2 3 4 5 6 7 8 9 11 12
0 2 3 4 5 6 7 8 10 11 12
0 2 3 4 5 6 7 9 10 11 12
0 2 3 4 5 6 8 9 10 11 12
0 2 3 4 5 7 8 9 10 11 12
0 2 3 4 6 7 8 9
The program will stop at that 9. The rest of that, and no other premutations, will be printed. Thats the problem. Its got nothing to do with time, it just stops there. It always does.