Originally Posted by
rogster001
The storage requirement is too big for a fixed array.
That's just stupid! How come your vector (of ints!) is not too big, then?
Code:
char x[14000000][6]; // ~80.1 MB
size_t lotto_6_49_generate() {
size_t i=0;
for (int a=1; a<=49; ++a) {
for (int b=a+1; b<=49; ++b) { if (b==a) continue;
for (int c=b+1; c<=49; ++c) { if (c==a||c==b) continue;
for (int d=c+1; d<=49; ++d) { if (d==a||d==b||d==c) continue;
for (int e=d+1; e<=49; ++e) { if (e==a||e==b||e==c||e==d) continue;
for (int f=e+1; f<=49; ++f) { if (f==a||f==b||f==c||f==d||f==e) continue;
char *p=x[i];
*p++=a; *p++=b; *p++=c; *p++=d; *p++=e; *p=f;
++i;
}}}}}}
return i;
}