C 语言版电子词典代码#include <> #include <> #include <> #include <> #include <> void Search() { FTLE *fp; char insert[20]; char word[40]; printf("Please input the word you want:\n"); ges(insert); fp=fopen("wordcage","r"); if(fp=NULL); { printf("\n\nSorry do not find what the word you want.\n\n"); fclose(fp); return; } while(!feof(fp)) /* 查询单词库*/ { fread(&wordcage,sizeof(wordcage),1,fp); printf("%s",word); fclose(fp); } void addword() { FILE *fp; fp=fopen("wordcage","r"); if(fp=NULL) fp=fopen("wordcage","w"); else { fclose(fp); fp=fopen("wordcage","a"); } char insert[10]; printf("Insert the new word:\n"); gets(insert); printf("Giving the meaning:\n"); scanf("%s",word); fclose(fp); printf("\n\n add word ess. \n\n"); } void worddel() { FILE *fp; Word *head,*p,*q; char word[10]; fp=fopen("Wordcage","rb"); if(fp==NULL) { printf("Error!"); fclose(fp); return; } head=p=q=(Word*)malloc(sizeof(word)); while(!feof(fp)) { q=p; p=(Word*)malloc(sizeof(Word)); fread(p,sizeof(Word),1,fp); q->next=p; } p->next=NULL; fclose(fp); clrser(); printf("Input the word:"); gets(word); p=head; while(p!=NUll) { if(strcmp(p->name,word)==0) { if(p==head) head=head->next; else q->next=p->next; break; } q=p; p=p->next; } while(head!=NULL) { fwrite(head,sizeof(Worrd),1,fp); } fclose(fp); clrscr(); } void cleanscrean() { printf("\n\n ******\n\n"); } int main() { int numble; MEN
C语言版电子词典代码 来自淘豆网www.taodocs.com转载请标明出处.