#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <windows.h>
#include <time.h>
using namespace std ;
const string outInfo[13] = {
"欢迎使用上机评测系统,请依提示操作,要退出系统,请输入\"exit\"\n\n" ,
"当前是第 " ,
" 题,您还有 " ,
" 次机会:\n" ,
"您已经选择退出,您的当前得分是: " ,
"\n系统即将退出,请再接再厉..." ,
"恭喜您回答正确,请继续回答下一题..\n\n" ,
"您的回答错误,请继续尝试..\n\n" ,
"您第 " ,
" 题的得分是 : " ,
" 。\n" ,
"您的总得分是 : " ,
" 。\n\n"
} ;
const string resultInfo[5] = {
"TRY AGAIN\n" ,
"PASS\n" ,
"OK\n" ,
"GOOD\n" ,
"SMART\n"
} ;
const int scoreGet[4] = {0 , 5 , 7 , 10} ;
int scoreEveryProblem[10] ;
int main() {
srand((unsigned)time(NULL)) ;
string inputInfo ;
cout << outInfo[0] ;
int score = 0 ;
for(int problemNumber = 1 ; problemNumber <= 10 ; problemNumber++) {
int res = rand() % 51 ;
int pa = rand() % (res + 1) ;
int pb = res - pa ;
bool op = rand() % 2 ;
if(op) swap(res , pa) ;
for(int tryTime = 3 ; tryTime >= 1 ; tryTime--) {
cout << outInfo[1] << problemNumber << outInfo[2]
<< tryTime << outInfo[3] ;
cout << pa << (op ? " - " : " + ") << pb << " = " ;
cin >> inputInfo ;
if(inputInfo.substr(0 , 4) == "exit") {
system("cls") ;
cout << outInfo[4] << score << outInfo[5] ;
for(int t = 0 ; t < 1000000000 ; t++) ;
return 0 ;
}
else {
int ans ;
sscanf(inputInfo.c_str() , "%d" , &ans) ;
if(ans == res) {
cout << outInfo[6] ;
score += scoreGet[tryTime] ;
scoreEveryProblem[problemNumber - 1] = scoreGet[tryTime] ;
break ;
}
else if(tryTime > 1) {
cout << outInfo[7] ;
}
else {
cout << pa << (op ? " - " : " + ") << pb << " = " << res << "\n\n" ;
}
}
}
}
for(int i = 0 ; i < 10 ; i++) {
cout << outInfo[8] << (i + 1) << outInfo[9]
<< scoreEveryProblem[i] << outInfo[10] ;
}
cout << outInfo[11] << score << outInfo[12] ;
cout << resultInfo[min(4 , max(0 , (score - 50) / 10))] << endl ;
system("pause") ;
return 0 ;
}