{
int Chinese(int i, int b = 0); int English(int i, string word, int b = 0); void Grade(int i, float j, int k, int *p);
string word, Key; char Set[10]; int a, b = 0; int i = 0, begin, i_1[2000], k = 0; float j;//i_1和k是记录答错的单词序号的,j统计分数
cout << "调成英文输入法;运行时输入Key查看答案;输入End以结束程序;" << endl << "Enter the section you want to test:";
cin >> Set;
while (Set[0]<‘A‘ || Set[0]>‘Z‘)
{
++i;
if (i % 3 == 0)
cout << "亲,请输入大写字母A~Z" << endl;
else
cout << "Please input A~Z" << endl;
cout << "Enter the section you want to test:";
cin >> Set;
}
if (Set[0] >= ‘B‘)
{
cout << "The information was not found;" << endl;
cout << "Enter any character to end.";
cin >> word;
return 0;
}/*---------------------------------------------------------------------------------限定输入的选择字母*/
English(0, "Null", (int)Set[0] - 64);
Chinese(0, (int)Set[0] - 64);/*------------------------------------------------输入练习的章节*/
cout << "从第几个单词开始听写好呢? ";
cin >> begin;
while (begin < 1 || begin>300)
{
cout << "请输入1~300之间的数字,亲: ";
cin >> begin;
}
for (i = 1 + begin - 1, j = 0; word != "End"; ++i)/*--------------------------------------------开始运行*/
{
cout << endl;
Chinese(i);
++j;
cin >> word;
if (word == "End")/*---------------------------------------------------------结束(下一道题已经开始了)*/
{
if (i == 1)
{
cout << "蛋疼";
return 0;
}/*-------------------------------------------------------------------------一道题也没做*/
else
{
Grade(i - begin + 1, j - 1, k, i_1);/*--下一道题的开头*/
return 0;
}
}
while (word == "Key")
{
cout << "Tell me your answer first. ";
cin >> word;
if (word == "End")/*-------------------------------------------------------结束(不看答案结束)*/
{
if (i == 1)
{
cout << "真蛋疼";
return 0;
}
else
{
Grade(i - begin + 1, j, k, i_1);/*----看答案时结束*/
return 0;
}
}
}/*--------------------------------------------------------------------------------是不是一上来就看答案并且让看就退了*/
a = English(i, word);/*----------------------------------------------------判断对错,对了返回1,错了返回0*/
if (a == 2)
{
cout << "The program went wrong...";
return 0;
}/*-----------------------------------------------------------一般不会出错的,26个字母*/
while (a != 1)
{
a = 0;
if (b == 0)
{
--j;
i_1[k] = i;
++k;
}/*------------------------------------------------------------------------------统计错题*/
b = 1;
cout << setw(22) << setfill(‘ ‘) << "Wrong ! Try again. ";
cin >> word;
if (word == "End")/*-----------------------------------------------------结束*/
{
Grade(i + 1, j, k, i_1);
return 0;
}
else if (word == "Key")/*------------------------------------------------看答案*/
{
cout << " ";
English(i, word);
cout << endl;
break;
}
else a = English(i, word);/*---------------------------------------------再试一次*/
}
b = 0;/*----------------------------------------------------------------统计错题用的*/
if (a == 1)
cout << setw(35) << setfill(‘ ‘) << "Right. Do you want to continue? ";/*-----------------------------------------------------自己做对的*/
else
cout << setw(28) << "Do you want to continue? ";
cin >> word;
}
Grade(i - begin + 1, j, k, i_1);
return 0;
}