?? 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 + -