Discussion Locked

need help

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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);
}

5 replies

by gsg

Duh, I was going to go into how his company was obviously too cheap to buy the software. I'm slow on the draw this morning and didn't even think about him being a student.

by realvannewkirk

wow, with all the c libraries out there youd think copy and paste from existing spell checker would be great. oops, now i'm giving away my secret on how i got through my first BASIC class.

by charliespencer

Everybody should know how to copy existing code. Why re-invent the wheel?

The trick is knowing what parts to copy and what to leave behind. This obviously requires learning to recognize what the code does. The best way of learning this is to (gasp) write code yourself.

by realvannewkirk

just to clarify, by the time i copied code in BASIC, i had written many thousands of lines of functioning code myself. not to mention, I was 13 and taking my first college course :) I remember when I first got into real programming languages and i wouldn't dare borrow other code bacause i wanted to be able to understand every aspect of what i was writing. if you just want to steal someone else's code and use it improperly because you don't fully understand what it does, maybe you should get a programming job at microsoft :)

This discussion is closed to new replies.