单词记忆王源代码

这是一个使用C++编写的单词记忆程序,提供菜单式操作,包括添加单词、顺序和随机测验、查询单词的中英文意思等功能。用户可以查询单词、记录未背诵的单词,并进行英语到中文或中文到英语的翻译。程序通过读取文本文件存储字典数据。
摘要由CSDN通过智能技术生成

/*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<<"请输入

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值