1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
char target[25] = {'\0'};
printf("\nEnter a word to search for.\n");
fgets(target,sizeof(target),stdin);
strtok(target, "\n");
while(strcmp(target,"-1") != 0){
printf("Target is: %s Top word is at pos: %d\n",target,wordCount);
pos = FindAWord(lib,target,wordCount-1);
if(pos == -1){
printf("The target word could not be found");
printf("\nEnter a word to search for.\n");
fgets(target,sizeof(target),stdin);
strtok(target, "\n");
continue;
}
if(isdigit(target[0])){
int year = atoi(target);
GetAnnualWLAvg(lib,year);
printf("\nEnter a word to search for.\n");
fgets(target,sizeof(target),stdin);
strtok(target, "\n");
continue;
}
if(isalpha(target[0])){
GetAWordFrequency(lib,frq,pos);
PrintGraph(frq,graph);
printf("\nEnter a word to search for.\n");
fgets(target,sizeof(target),stdin);
strtok(target, "\n");
continue;
}
}
|