need help - TechRepublic
General discussion
November 23, 2008 at 07:57 PM
jadams002

need help

by jadams002 . Updated 17 years, 7 months ago

for my company i need to make a spell check
program, i am using C. shown below is what i
have already completed

int main(void)
{

char word[20] = { };
FILE *fp;
char final_input[20] = { };
int i = 0;//varable
int main_menu =0;
while(1)
{
//ask for word
printf(“Please enter your word
\nPlease make sure the word is lowercase\n\n”);
fflush(stdin);
scanf(“%s”, word);

//open file
//check if exist
//error check
fp=checkExists(dictionary);

//check if in dictionary
while(!feof(fp))
{
fflush(stdin);
fscanf(fp, “%s” ,
final_input);
strcmp(word, final_input);

if(strcmp(word,
final_input)==0)
{
printf(“Your word is
spelled correctially\n\n”);

}//end of if statement

else
{
fflush(stdin);
fflush(stdin);
fscanf(fp, “\n”,
final_input);

}//closes else statement

i++;//interval

}//end of while loop
}

//pause then quit
system(“pause”);
return(0);
}

This discussion is locked

All Comments