Moderator: MacroQuest Developers
Code: Select all
CString output = "IIII";
for (x = 0; x < 16; x++) {
for (y = 0; y < 4; y++) {
if (x & (2^y))
output[y] = 'L';
else
output[y] = 'I';
}
// print out the string "output" here
}Code: Select all
CString* output;
for (n = 4; n <= 25; n++) {
output = new CString('I', n); // this is the repeat constructor, builds a string of length n of the letter 'I'
for (x = 0; x < (2^n); x++) {
for (y = 0; y < n; y++) {
if (x & (2^y))
output[y] = 'L';
else
output[y] = 'I';
}
// print out the string "output" here
}
}
I have no idea what this means.... but based on the other post:vladd wrote:I would like to take 2 letters with a minimum of 4 characters maximum of 25 characters and generate random combonations into a txt file.
Code: Select all
#include <stdio.h>
main()
{
int i,j,k;
for(k=4;k<26;k++) {
printf("doing %d len\n", k);
for (j=0;j<1<<k;j++) {
for(i=0;i<k;i++) {
printf("%c", (j & (1<<i)) ? 'I' : 'L' );
}
printf("\n");
}
}
}
What compiler are you using? because when I try this in Visual C++ 2008 Express Edition I get a c4430 error which deals with missing type specifier - int assumed.dont_know_at_all wrote:I have no idea what this means.... but based on the other post:vladd wrote:I would like to take 2 letters with a minimum of 4 characters maximum of 25 characters and generate random combonations into a txt file.Code: Select all
#include <stdio.h> main() { int i,j,k; for(k=4;k<26;k++) { printf("doing %d len\n", k); for (j=0;j<1<<k;j++) { for(i=0;i<k;i++) { printf("%c", (j & (1<<i)) ? 'I' : 'L' ); } printf("\n"); } } }

Change:vladd wrote:What compiler are you using? because when I try this in Visual C++ 2008 Express Edition I get a c4430 error which deals with missing type specifier - int assumed.dont_know_at_all wrote:I have no idea what this means.... but based on the other post:vladd wrote:I would like to take 2 letters with a minimum of 4 characters maximum of 25 characters and generate random combonations into a txt file.Code: Select all
#include <stdio.h> main() { int i,j,k; for(k=4;k<26;k++) { printf("doing %d len\n", k); for (j=0;j<1<<k;j++) { for(i=0;i<k;i++) { printf("%c", (j & (1<<i)) ? 'I' : 'L' ); } printf("\n"); } } }
Just wondering because I have 2 others I haven't loaded but if its one of the ones I don't have loaded I can load it up...
Code: Select all
main() {Code: Select all
int main() {
