英汉电子词典_设计_C语言_C语言程序设计__课程设计.doc
#include<stdio.h>char word20040,meaning20040;int ch;main ()menu:printf("*MENU*n"); printf("1*searchn"); printf("2*creatn"); printf("3*deleten"); printf("4*updaten"); printf("5*exitn"); printf("*n"); printf("please make your choice from 1 to 5n"); scanf("%d",&ch); switch(ch) case 1:search(); break;case 2:creat(); break;case 3:dele(); break;case 4:update(); break;case 5:break;default:main(); int search() char temp40; char s,g; int a,b,d,i,j; printf("n please press the wordn"); scanf("%s",temp); s=temp0; for(i=0,j=0;s!='0'&&j<=40;)s=tempj; if(strcmp(wordij,s)=0) j+; else j=0; i+; d=j-1; if(strcmp(wordid,s)=0)printf("n"); for(a=0;temp0!='0'&&a<=40;a+) printf("%s",tempa); printf("n meansn"); for(b=0;tempb!='0'&&b<=40;b+) printf("%s",meaningib); loop1:printf("n*n"); printf("do you want to continue;choose y or nn"); scanf("%c",&g); switch(g) case 'y':search( ); break; default:main(); elseprintf("no this wordn"); goto loop1; int creat( ) int x,c; char t,g,neww40,newm40; t='0' printf("n"); if (word2000='0') for(x=0;x<=200;x+) if(strcmp(wordx0,t)=0) break; else continue; printf("n input the new wordn"); scanf("%s",&neww40); printf("n input its meaningn"); scanf("%s",&newm40); for(c=0;newwc!='0'&&c<=40;c+) wordxc=newwc; meaningxc=newmc; printf("n successn"); else printf("n the dictionary is fulln"); printf("*n"); printf("do you want to continue; choose y or nn"); scanf("%c",&g); switch(g) case 'y':creat( ); break; default:main(); int dele( ) char temp40,z,g,s; int d,i,j,q,k; printf("n please press the wordn"); scanf("%s",temp); s=temp0; for(i=0,j=0;s!='0'&&j<=40;) s=tempj; if(strcmp(wordij,s)=0) j+; else j=0; i+; d=j-1; if(strcmp(wordid,s)=0) printf("n are you sure to delete it;choose y or nn"); scanf("%c",&z); switch(z)case 'y':q=i+1; for(;i<200;i+,q+) for(k=0;k<=40;k+) wordik=wordqk; meaningik=meaningqk; word2000='0' meaning2000='0' printf("n successn"); printf("*nn"); printf("do you want to continue; choose y or nn"); scanf("%c",&g); switch(g) case 'y':dele(); break; default:main(); default:printf("*nn");printf("do you want to continue; choose y or nn");scanf("%c",&g); switch(g) case 'y':dele( ); break; default:return(0); break; else printf("n no this wordn"); printf("*nn"); printf("do you want to continue; choose y or nn"); scanf("%c",&g); switch(g) case 'y':dele( ); break; default:main(); int update( ) char temp40,s,g; int d,i,j,v; printf("n please press the word you want to updaten"); scanf("%s",temp); s=temp0; for(i=0,j=0;s!='0'&&j<=40;) s=tempj; if(strcmp(wordij,s)=0) j+; else j=0; i+; d=j-1; if(strcmp(wordid,s)=0) char rw40,rm40; printf("n please input the word changedn"); scanf("%s",rw); printf("n please input its meaningn"); scanf("%s",rm); for(v=0;rwv!='0'&&v<=40;v+) wordiv=rwv; meaningiv=rmv; printf("n successn"); printf("*n"); printf("do you want to continue; choose y or nn"); scanf("%c",&g); switch(g)case 'y':update( ); break; default:main(); else printf("n no this wordn"); printf("*nn"); printf("do you want to continue; choose y or nn"); scanf("%c",&g); switch(g) case 'y':update(); break; default:main();