📄 level4.cpp
字号:
#include "1.h"
extern int n4;
extern int s4;
extern int r4;
level4_word l4_word[20];
void level4(void)
{
ifstream innum_word("num_word4.txt",ios::in);
if (!innum_word)
{
cerr<<"open error"<<endl;
exit(1);
}
innum_word>>n4;
innum_word.close();
ifstream word("level4_word.txt",ios::in);
if (!word)
{
cerr<<"open error"<<endl;
exit(1);
}
for(int j=0;j<n4;j++)
{
word>>l4_word[j].english;
word>>l4_word[j].chinese;
}
word.close();
C:
system("cls");
cout<<endl<<endl<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" | ~心 莹 背 单 词~ |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
cout<<" 请选择适合您的模式:"<<endl<<endl;
cout<<" 1.浏览记忆"<<endl<<endl;
cout<<" 2.瞬间记忆"<<endl<<endl;
cout<<" 3.顺序测验"<<endl<<endl;
cout<<" 4.随机测验"<<endl<<endl;
cout<<" 5.帮助信息"<<endl<<endl;
cout<<" 6. 退出"<<endl;
string d41;
cin>>d41;
system("cls");
if (d41=="1")
{
v:
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<" 四级要考查的单词为:"<<endl<<endl;
for(int i=0;i<n4;i++)
{
cout<<" "<<setw(10)<<l4_word[i].english;
cout<<" "<<setw(10)<<l4_word[i].chinese<<endl<<endl;
}
cout<<" 1.继续背诵 2.退出"<<endl;
string d411;
cin>>d411;
system("cls");
if (d411=="1") goto C;
else if (d411=="2") exit();
else
{
cout<<" 您输入的信息错误,请重新输入......."<<endl;
cout<<" 请按回车键继续..."<<endl;
while(!kbhit());
getchar();
system("cls");
goto v;
}//不是这两个数
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
else if (d41=="2")
{
cout<<endl<<endl<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" | ~心 莹 背 单 词~ |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
cout<<" 系统会每次显示一个单词和它的意思,供您记忆......"<<endl<<endl<<endl;
for(int i=0;i<n4;i++)
{
cout<<" "<<setw(10)<<l4_word[i].english;
cout<<" "<<setw(10)<<l4_word[i].chinese<<endl<<endl;
m:
cout<<" 如果您已经掌握了这个单词, 继续..y/n?."<<endl<<endl;
string e;
cin>>e;
if(e=="y") continue;
else if(e=="n") break;
else
{
cout<<" 您输入的信息错误,请重新输入......."<<endl;
cout<<" 请按回车键继续..."<<endl;
while(!kbhit());
getchar();
system("cls");
goto m;
}
}
u:
cout<<" 您已经浏览了所有的单词,恭喜您~!~"<<endl<<endl;
cout<<" 1.继续背诵"<<endl<<endl;
cout<<" 2. 退出"<<endl<<endl;
string d412;
cin>>d412;
system("cls");
if (d412=="1")
{
goto C;
}
else if(d412=="2") exit();
else
{
cout<<" 您输入的信息错误,请重新输入......."<<endl;
cout<<" 请按回车键继续..."<<endl;
while(!kbhit());
getchar();
system("cls");
goto u;
}//存在这样的问题,如果用户输入的不是1和2
}
///////////////////////////////////////////////////////////////////////////////////////////////////
else if (d41=="3")
{
char old_name[10];
cout<<endl<<endl<<endl<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" | ~心 莹 背 单 词~ |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl<<endl;
ifstream name("name1.txt",ios::in);
if (!name)
{
cerr<<"open error"<<endl;
exit(1);
}
name>>old_name;
cout<<" "<<old_name;
cout<<"您好!"<<endl<<endl<<endl<<endl;
cout<<" 准备好了吗?"<<endl<<endl;
cout<<" 准备好了按回车键开始......"<<endl;
while(!kbhit());
getchar();
system("cls");
memory4();
name.close();
}
else if (d41=="4")
{
char old_name[10];
cout<<endl<<endl<<endl<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" | ~心 莹 背 单 词~ |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl<<endl;
ifstream name("name1.txt",ios::in);
if (!name)
{
cerr<<"open error"<<endl;
exit(1);
}
name>>old_name;
cout<<" "<<old_name;
cout<<"您好!"<<endl<<endl<<endl<<endl;
cout<<" 准备好了吗?"<<endl<<endl;
cout<<" 准备好了按回车键开始......"<<endl;
while(!kbhit());
getchar();
system("cls");
memory4_r(); // 调用随机测试函数
name.close();
}
else if (d41=="5")
{
cout<<endl<<endl<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" | 背 诵 快 速 入 门 |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl;
cout<<" 欢迎您使用本帮助信息,也感谢您对心莹的支持.我们定会尽我们的最大努力为您服务."<<endl;
cout<<" -------石海杰"<<endl<<endl<<endl;
cout<<" 进入功能选择界面,您将会看到提示信息.如果您想要记忆单词请您选择浏览记忆或瞬间"<<endl<<endl;
cout<<"记忆,来帮助您好的记忆.当您记忆完或者是您已经认为掌握也可以选择直接测试."<<endl;
cout<<endl<<endl<<" 更多功能我在此就不一一介绍了,每一步都会有系统提示."<<endl;
cout<<endl<<endl<<" 希望你对我们提出宝贵的意见和建议.谢谢您的使用~!"<<endl<<endl;
cout<<" 1.开始背诵; "<<endl;
cout<<" 2.退出."<<endl;
string d21;
cin>>d21;
system("cls");
if (d21=="1") goto C; //返回背诵界面
if (d21=="3") system("exit");
}
else if (d41=="6") exit();
else
{
cout<<" 您输入的信息错误,请重新输入..."<<endl;
cout<<" 请按回车键继续..."<<endl;
while(!kbhit());
getchar();
system("cls");
goto C;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void memory4(void)
{
int m=0; //统计已经背诵的单词个数
cout<<endl<<endl<<endl;
cout<<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" | ~心 莹 背 单 词~ |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
cout<<" 现在开始背诵!"<<endl;
cout<<" 下面系统将会输入单词的汉语意思,请您拼写~"<<endl;
char word_c[15];
ifstream word("level4_word.txt",ios::in);
if (!word)
{
cerr<<"open error"<<endl;
exit(1);
}
for(int j=0;j<n4;j++)
{
word>>l4_word[j].english;
word>>l4_word[j].chinese;
}
word.close();
int p,q;
level4_word w;
for(p=0;p<n4-1;p++)//对已有的单词排序
{
for(q=0;q<n4-1-p;q++)
{
if(strcmp(l4_word[q].english,l4_word[q+1].english)>0)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -