有一天突然看到前辈写的这个
于是突发奇想复现了一个
并且完善了功能
还有AI加成让你感受更舒适
其实挺傻的QAQ
仍然是第一次看到某个单词就会展示
然后之后都是给出意思测验,错误一定次数会给出首字母,再错就会展示单词
真正的功能改进其实是强制在第一次看到时和测试给出单词后强制要求复读数次
使用前要把要记的单词放在english.in中,用ANSI编码保存,然后就可以了
后面可能会有存档或者自选参数的功能?预感咕咕咕已加
另外有评分机制了QwQ如何评分自己试试吧
就酱QAQ
update 2021.10.9
想不到自己还有用上这东西的一天...
作为复健的一个小练习改了一点代码QAQ
应该会比之前科学QAQ
update 2021.10.26
改了一些机制
现在第一次打开的体验应该能提升一些
然后现在能实时保存了这一部分还没经过Debug...应该没啥问题
就酱QAQ
#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
int n, m, all, hget, rept, beft, aftt;
wstring s1, s2;
vector<pair<wstring, wstring> >sv;
vector<int>t, gpos;
char ccc;
int stop()
{
cout << "Press any key to continue..." << endl;
_getch(); return 0;
}
int init()
{
wifstream fin("english.in");
wifstream fsv("english.save");
fsv >> rept >> beft >> aftt;
if (!(rept || beft || aftt))rept = 3, beft = 2, aftt = 1;
while (getline(fin, s1))getline(fin, s2), fsv >> m,
sv.push_back(make_pair(s1, s2)), t.push_back(m);
fin.close();
fsv.close();
return 0;
}
int save()
{
wofstream fout("english.save");
fout << rept << ' ' << beft << ' ' << aftt << endl;
for (int i = 0; i < n; i++)
fout << t[i] << endl;
fout.close();
return 0;
}
int repeat(int pos)
{
cout << "Type it for " << rept << " times!" << endl;
int tot = rept;
for (int j = 1; j <= rept; j++)
{
getline(wcin, s1);
if (s1 == sv[pos].first)cout << "You are right!" << endl;
else cout << "You are wrong, try again!" << endl, j--, tot = max(0, tot - 1);
if (j != rept)cout << rept - j << " times left." << endl;
}
return tot;
}
int getpos()
{
int ans = 1e9;
for (int i = 0; i < n; i++)ans = min(ans, t[i]);
gpos.clear();
for (int i = 0; i < n; i++)
if (t[i] - ans <= 2)gpos.push_back(i);
return gpos[rand() % gpos.size()];
}
int main()
{
init();
n = sv.size();
do {
system("cls");
cout << "Welcome!" << endl;
cout << "1: Start" << endl;
cout << "2: Reset" << endl;
cout << "3: Settings" << endl;
cout << "Caution: You should save word in ANSI." << endl;
ccc = _getch();
} while (ccc < '1' || ccc>'3');
if (ccc == '2')
{
for (int i = 0; i < n; i++)
t[i] = 0;
save();
return 0;
}
if (ccc == '3')
{
do {
system("cls");
cout << "What mode do you want to use?" << endl;
cout << "1: 1 time(s) repeat 1 time(s) chance 1 time(s) last chance" << endl;
cout << "2: 2 time(s) repeat 2 time(s) chance 1 time(s) last chance" << endl;
cout << "3: 3 time(s) repeat 2 time(s) chance 1 time(s) last chance" << endl;
cout << "4: 3 time(s) repeat 3 time(s) chance 2 time(s) last chance" << endl;
cout << "5: others" << endl;
ccc = _getch();
} while (ccc < '1' || ccc>'5');
if (ccc == '1')rept = 1, beft = 1, aftt = 1;
if (ccc == '2')rept = 2, beft = 2, aftt = 1;
if (ccc == '3')rept = 3, beft = 2, aftt = 1;
if (ccc == '4')rept = 3, beft = 3, aftt = 2;
if (ccc == '5')
{
cout << "Repeat time(s):";
cin >> rept;
cout << "Test chance time(s):";
cin >> beft;
cout << "Test last chance time(s):";
cin >> aftt;
}
save();
return 0;
}
system("cls");
cout << "How many times?" << endl;
cin >> m;
while (getchar() != '\n');
system("cls");
srand(time(0));
for (int i = 1; i <= m; i++)
{
cout << '#' << i << ' ';
int pos = getpos();
if (rand() % 5 >= t[pos])
{
cout << "Learn" << endl;
wcout << sv[pos].first << endl;
wcout << sv[pos].second << endl;
all += rept;
hget += repeat(pos);
stop();
t[pos]++;
}
else
{
cout << "Test" << endl;
wcout << sv[pos].second << endl;
cout << "Please tell me the word:" << endl;
bool is = 0;
int tot = beft + aftt;
all += tot;
for (int j = 1; j <= beft; j++)
{
getline(wcin, s1);
if (s1 == sv[pos].first)
{
is = 1;
cout << "You are right!" << endl;
stop();
break;
}
else cout << "You are wrong, try again!" << endl, tot = max(0, tot - 1);
}
if (!is)
{
cout << "You have tried " << beft << " times!" << endl;
cout << "The first letter of the word is ";
wcout << sv[pos].first[0] << '.' << endl;
for (int j = 1; j <= aftt; j++)
{
getline(wcin, s1);
if (s1 == sv[pos].first)
{
is = 1;
cout << "You are right!" << endl;
stop();
break;
}
else { if (j != aftt)cout << "You are wrong, try again!" << endl; tot = max(0, tot - 1); }
}
if (!is)
{
cout << "You have tried " << beft + aftt << " times!" << endl;
cout << "The word is ";
wcout << sv[pos].first << '.' << endl;
repeat(pos);
stop();
t[pos]--;
}
}
hget += tot;
}
save();
system("cls");
}
cout << "Finish!\nYou got " << hget << '/' << all << " scores!" << endl;
if (hget == all)cout << "Perfect!" << endl;
else if (hget >= all * 0.9)cout << "Excellent!" << endl;
else if (hget >= all * 0.8)cout << "Great!" << endl;
else if (hget >= all * 0.7)cout << "Good!" << endl;
else if (hget >= all * 0.6)cout << "OK!" << endl;
else if (hget >= all * 0.5)cout << "Not too bad!" << endl;
else if (hget >= all * 0.3)cout << "Bad!" << endl;
else cout << "Failed..." << endl;
stop();
return 0;
}