当前位置:文档之家› 电子英汉词典C 编程

电子英汉词典C 编程

if(s<=n-1) {
if(strcmp(word[s].eng,r)==0) {
x=1; for(t=s;t<n;t++) {
strcpy(word[t].eng, word[t+1].eng); strcpy(word[t].ci, word[t+1].ci); strcpy(word[t].yin, word[t+1].yin); strcpy(word[t].chi, word[t+1].chi); } } } else { if(strcmp(word[n].eng,r)==0) z=1; else z=0; } } if(z==1||x==1) { cout<<"\n\n 删除成功!\n"<<endl; n--; cout<<"\n Please press any key with Enter key back!"<<endl; cin>>m; } else {
break;
else
conticmp(word[n].eng,r)==0)
break;
else
{
char m[1];
cout<<"\n
No this word!!\n
Please
press any key with Enter key back!"<<endl;
cin>>m;
goto loop;
} cout<<"\n\n cout<<"\n\n cout<<"\n\n
}
English(英文): "<< word[s].eng<<endl; Cixing(词性): "<< word[s].ci<<endl; Yinbiao(音标): "<< word[s].yin<<endl;
else
if(strcmp(word[n].eng,r)==0)
break;
else
{
char m[1];
cout<<"\n
No this word!!\n
press any key with Enter key back!"<<endl;
cin>>m;
goto loop;
} cout<<"\n\n cout<<"\n\n cout<<"\n\n cout<<"\n\n
case '5': exit(1);break; }
} out_file(); }
cout<<"\n\n Chinese(中文): "<<word[n].chi<<endl; cout<<"\n Please press any key with Enter key back!"<<endl; cin>>m; } break; case '2': { char r[10]; int s,t,z=0,x=0; cout<<"\n 请输入您要删除的单词:"; cin>>r; for(s=0;s<=n;s++) {
Please
cout<<"\n\n cout<<"\n\n cout<<"\n cin>>m; }break;
Yinbiao: "<< word[n].yin<<endl; Chinese(中文): "<<word[n].chi<<endl; Please press any key with Enter key back!"<<endl;
if(s<=n-1) if(strcmp(word[s].chi,r)==0) break; else continue; else if(strcmp(word[n].chi,r)==0) break; else { char m[1]; cout<<"\n No this word!!\n Please press any
key with Enter key back!"<<endl; cin>>m; goto loop;
} } cout<<"\n English(英文): "<<word[s].eng<<endl; cout<<"\n\n Cixing: "<< word[s].ci<<endl; cout<<"\n\n Yinbiao: "<< word[s].yin<<endl; cout<<"\n\n Chinese(中文): "<< word[s].chi<<endl; cout<<"\n\n\n Please press any key with Enter key back!"<<endl; cin>>m; } break; } } case '4': { char j[10],k[15],l[10],p[30],r[10],m[1]; int s; ++n;
cout<<"2.中译英. \n"<<endl;
cout<<" 请选择:";
cin>>l;
switch(l)
{
case 1:
{
char r[10],m[1]; int s;
cout<<"\n 请输入您所需要查询的英文单词:";
cin>>r;
for(s=0;s<=n;s++)
{
if(s<=n-1)
if(strcmp(word[s].eng,r)==0)
电子英汉词典编程
#include<iostream> #include<fstream> using namespace std; class dictionary { public:
char eng[10]; char ci[15]; char yin[10]; char chi[30]; }word[1000]={{"dog","n","dog","狗"}, {"clean","adj+d+v","kli:n","1.干净 2.整洁"}, {"finally","ad","fai'nens","最终,终于"}, {"finish","v+n","finish","完成"}, {"go","n+v","gou","走"}, {"high","aadj+ad+n","hai","高"}, {"help","int+n","help","帮助"}, {"here","ad+ini","hie","这里"}, {"idea","n","ai'die","注意"}, {"imagine","v","i'madgin","想象"}, {"king","n","king","国王"}, {"xq","n","leit","1.熊强"}, {"name","n+v","neim","名字"} }; void in_file() { fstream in_f("C:\\Users\\Administrator\\Desktop\\1.dat",ios::binary|ios::in); in_f.read((char *)word,1000*sizeof(word[0])); in_f.close(); } void out_file() { fstream out_f("C:\\Users\\Administrator\\Desktop\\1.dat",ios::binary|ios::out); out_f.write((char *)word,1000*sizeof(word[0])); out_f.close(); }
cout<<"\n 修改单词"<<endl;
cout<<"\n\n please enter the word you want change: ";
相关主题