首页 > 代码库 > 背单词软件
背单词软件
1 //JerryZheng版权所有 2 #include<iostream> 3 #include<fstream> 4 #include<ctime> 5 #include<cstdlib> 6 #include<string> 7 #include<conio.h> 8 #include<windows.h> 9 using namespace std; 10 11 string s[128],stemp; 12 int score,n,et,st; 13 14 void middle(string x) //在屏幕中间输出字符串 15 { 16 cout<<endl; 17 cout<<endl; 18 cout<<" "<<x<<endl; 19 } 20 21 void gotoxy(int x,int y) //光标定位 22 { CONSOLE_SCREEN_BUFFER_INFO csbiInfo; 23 HANDLE hConsoleOut; 24 hConsoleOut=GetStdHandle(STD_OUTPUT_HANDLE); 25 GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo); 26 csbiInfo.dwCursorPosition.X=x; 27 csbiInfo.dwCursorPosition.Y=y; 28 SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition); 29 } 30 31 void cover() //封面设计 32 { 33 system("cls"); 34 cout<<endl; 35 cout<<endl; 36 cout<<endl; 37 cout<<endl; 38 cout<<endl; 39 cout<<endl; 40 cout<<" 背单词"<<endl; 41 cout<<endl; 42 cout<<" ----by Jerry Zheng 郑佳睿"<<endl; 43 cout<<endl; 44 cout<<" 1.6.34版本 更新2017-04-15"<<endl; 45 cout<<endl; 46 cout<<" 检查更新请发邮件至jerryzheng2005@126.com"<<endl; 47 cout<<endl; 48 cout<<endl; 49 cout<<endl; 50 cout<<endl; 51 cout<<endl; 52 cout<<endl; 53 cout<<endl; 54 cout<<endl; 55 cout<<endl; 56 cout<<endl; 57 cout<<endl; 58 system("pause"); 59 system("cls"); 60 return; 61 } 62 63 int main() 64 { 65 char ch; 66 int temp,tempn; 67 fstream ans; 68 std::ios::sync_with_stdio(false); //加快cin cout 69 cover(); 70 ans.open("answer.txt",ios::in); 71 ans>>n; 72 cout<<"复习:"<<endl; //复习 73 for (int i=0;i<n;i++) 74 { 75 ans>>s[i]; 76 cout<<s[i]<<endl; //复习 77 } 78 ans.close(); 79 cout<<endl; 80 system("pause"); //停顿 81 system("cls"); //反作弊 82 while (1) //药不能停 83 { 84 srand(time(0)); //因为运行时间长,每次重设 85 tempn=rand()%n; //取哪个单词 86 stemp=s[tempn]; //存入临时变量 87 temp=rand()%s[tempn].size(); //挖哪个空 88 stemp[temp]=‘_‘; //挖空 89 middle(stemp); //输出 90 et=clock(); //计时开始 91 gotoxy(34+temp,2); //光标在空上 92 do {} while (kbhit()); //等待输入 93 ch=getch(); //输入 94 gotoxy(0,3); 95 if (ch==s[tempn][temp]) cout<<"你赢了! +10"<<endl,score+=10; //说明 96 else cout<<"你输了! -10"<<endl,score-=10; 97 cout<<"你的分数:"<<score<<endl; 98 st=clock(); //停止计时 99 cout<<"时间:"<<(float)((st-et)/1000)<<"秒"<<endl; 100 cout<<"强行关闭以离开"<<endl; 101 system("pause"); 102 system("cls"); //良好的界面 103 } 104 return 0; 105 }
仅仅为源代码,感兴趣者联系我下载软件
背单词软件
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。