《英汉电子词典_设计_C语言_C语言程序设计__课程设计.doc》由会员分享,可在线阅读,更多相关《英汉电子词典_设计_C语言_C语言程序设计__课程设计.doc(5页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、#includechar 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:
2、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;tem
3、p0!=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
4、,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
5、 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(
6、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(;i200;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 t
7、o 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 con
8、tinue; 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(
9、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();