该程序基本上搜索给定词列表中的字符串,该字符串是从终端输入的字的字谜.它遵循以下算法:
现在的问题是它在我的机器上运行完美,但在其他人的计算机上却运行不正常.我在这里包含代码并提供wordlist的链接.我知道要求你们下载单词列表然后编译和检查是太多了,但如果你让我知道它会意味着很多.我正在使用2.6.38-13-generic-pae运行Ubuntu 11.04
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
typedef struct x
{
int hashvalue;
char dictword[100];
char ascending[100];
struct x *next;
} node;
char *sortWord(char *);
//double fact(int);
void main()
{
FILE *fp1, *fp2;
char ch1;
while(ch1!='q')
{
char *dictsort;
dictsort=(char *)malloc(100*sizeof(char));
fp1=fopen("wordlist.txt", "r");
char ch;
int i=0;
char *sortedword;
int hashindex;
long int n;
printf("Please enter size of hashtable or press Ctrl+C to break:\n");
scanf("%ld", &n);
node *hashtable[n];
node *temp;
char test1[50];
char *test;
printf("Please enter …Run Code Online (Sandbox Code Playgroud) c ×1