电子英汉词典编程 #include #include 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(); } void main() { in_file(); static int n=13; char m; loop: while(1) { system("cls"); cout<<"\n\t============欢迎进入电气3 班牌英汉词典============"<>m; switch(m) { case '1': { char j[10],k[15],l[10],p[30]; ++n; cout<<"\n 增加单词"<>j; cout<<"\n 输入词性:"; cin>>k; cout<<"\n 输入音标:"; cin>>l; cout<<"\n 输入中文:"; cin>>p; strcpy(word[n].eng,j); strcpy(word[n].ci,k); strcpy(word[n].yin,l); strcpy(word[n].chi,p); cout<<"\n Please check it:"; cout<<"\n\n English(英文): "<