I found an anagram program.. but it was designed for unix. Can someone help me convert it to windows? Or if someone has a better anagram algorithm?
Code:
============================= canonize.c ===================================
#include <stdio.h>
#include <string.h>
int charcmp(const char *c1, const char *c2) {
return(*c1-*c2);
}
int main(int argc, char **argv) {
char word[256], canon[256];
for (;;) {
if (gets(word) == NULL) break;
strcpy(canon, word);
qsort(canon, strlen(canon), sizeof(char), charcmp);
printf("%s=%s\n", canon, word);
}
return(0);
}
============================== gather.c ====================================
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
char line[256], lastcanon[256], lastword[256], *word;
strcpy(lastcanon, "*Undefined*");
for (;;) {
if (gets(line) == NULL) break;
if ((word = strchr(line, '=')) == NULL) break;
*word++ = '\0';
if (strcmp(line, lastcanon) == 0) {
printf("%s = %s\n", lastword, word);
}
strcpy(lastcanon, line);
strcpy(lastword, word);
}
return(0);
}
Also, will it take a long time to find all possible words using only 7 specifc letters on a P4 using this? Probably not but just curious.
Thanks
Helix