/*4.作一个背单词的小程序
设计一背单词的小程序,程序以菜单方式工作,字典使用文本文件存放就可以了。使之能提供以下功能:
添加新词
支持顺序测验和随即测验
记录没背过的词
查找单词的汉语或英语意思(输入中文查对应的英语意思,输入英文查对应汉语意思)
*/
#include<iostream>
#include<fstream>
#include <ctime>
#include <cstdlib>
#include <process.h>
#include<string>
using namespace std;
string word[1000];
void search_1 ();
void search_2 ();
void test();
void go();
void random();
void read();
void save_to_file();
int m,number,i,Y,Q=21;
char W;
int main() //主函数开始
{ // save_to_file(); //调用保存函数
W=(char)Q;
cout<<" "<<W<<"欢迎使用单词记忆王程序"<<W<<" /n";
cout<<" produced by workgroup /n";
cout<<" 联系方式:TEL:13911395274 QQ 997274787. /n";
go();
return 0;
} //主函数结束
//翻译模块开始
void search_1 () //英文比较函数开始
{read();
string english;
int b=1,c,d=2;
cout<<"请输入您要查询的英文单词:";
cin>>english;
for (int i=0;i<1000;i++)
if(english==word[i])
{cout<<word[i]<<"的中文意思是:"<<word[i+1]<<endl;
cout<<"请输入您的选择:[1]=继续查询;[2]=退出到主菜单。";
cin>>c;
system("cls");
if (b==c) search_1( );
if (d==c) go();
if((b!=c)&&(d!=c))
{cout<<"sorry!you are wrong!"<<endl;
cout<<"please,make your choice again!"<<endl;
go();}
}
{cout<<"对不起,没有这个单词!"<<endl;
cout<<"请您选择:[1]=增加新单词;[2]=返回主菜单。";
cin>>c;
system("cls");
if (b==c) save_to_file( );
if (d==c) go();
if((b!=c)&&(d!=c))
{cout<<"sorry!you are wrong!"<<endl;
cout<<"please,make your choice again!"<<endl;
go();}
}
} //英文比较函数结束
void search_2 () //中文比较函数开始
{read();
string chinese;
int e=1,f,g=2;
cout<<"请输入您要查询的中文单词:";
cin>>chinese;
for (int j=0;j<1000;j++)
if(chinese==word[j])
{cout<<word[j]<<"的英文意思是:"<<word[j-1]<<endl;
cout<<"请输入