新增两个功能,一个彩蛋;
功能:
一:口算练习
二:打字练习
彩蛋:
一:随机无限弹窗
输入33449944即可,我就不演示了^_^
源代码:
#include <iostream>
#include <ostream>
#include <istream>
#include <windows.h>
#include <time.h>
#include <cstdlib>
#include <random>
#include <ctime>
#include <conio.h>
#include <stdio.h>
const int N = 20140801;
const int U = 34494;
const long long S = 344944;
const long long M =33449944;
#define wufawanhuidejuxingerror system
using namespace std;//命名空间
int qiaozhuozitwo() //定义函数qiaozhuozi
{
wufawanhuidejuxingerror("color 0c");//将文字颜色换成红色
int c;//定义变量c
printf("你想玩几次?请输入一个数:\n");//输出 "你想玩几次?请输入一个数:"并换行
cin>> c;//输入c
for(int d=0;d<c;d++)//for循环,定义d,d<输入的c,d自增
{//无
unsigned long long a=0;//定义变量a,赋值为0
unsigned long long b=0;//定义变量b,赋值为0
cout << "你想从几开始循环?请输入一个数:\n";//输出"你想从几开始循环?请输入一个数:"并换行
cin >> a;//输入a
cout << "你想从哪里结束循环?请输入一个数:\n";
cin >> b;
for(;a<=b;a++)
{
if(a%7==0||a/7==7||a/7==0||a/10==7||a%10==7||a%7==7)
{
cout << a << "敲桌子!!!" << endl;
}
else if(a==N)
{
wufawanhuidejuxingerror("color A");
cout << "哇塞~你竟然输入了作者的生日!!!!!!!" << endl;
}
else
{
cout << a << endl;
}
}
}
wufawanhuidejuxingerror("color F");
return 34-34;
}
void help(void)
{
printf("***************************************");
printf("\n输入过程中无法退出!******************");
printf("\n请按照所给字母敲击键盘!**************");
printf("\n按任意键开始测试,按下首字母时开始计时*");
printf("\n输入出错则以——表示********************");
printf("\n***************************************\n");
}
int daziyouxi()
{
char ch;
char str[51] = "";
int i;
int count = 0;
time_t start_time=0, end_time=0;
while (1)
{
system("cls");
help();
ch = _getch();
srand((unsigned int)time(NULL));
for (i = 0; i < 50; i++)
{
str[i] = rand() % 26 + 'a';
}
str[50] = '\0';
printf("%s\n", str);
count = 0;
for (i = 0; i < 50; i++)
{
ch = _getch();
if (i == 0)
{
start_time = time(NULL);
}
if (ch == str[i])
{
count++;
printf("%c", ch);
}
else
{
printf("_");
}
}
end_time = time(NULL);
printf("\n正确率:%d %c\n", count * 100 / 50, '%');
printf("用时%lld秒\n", (long int)end_time - start_time);
while (1)
{
ch = _getch();
if (ch == ' ')
{
break;
}
if (ch == 27)
{
return 0;
}
}
}
return 0;
}
int hahaerror()
{
srand((unsigned)time(0));
system("color 40");
int a;
a=rand()%2;
if(a==0)
{
while(true)
{
MessageBox(NULL,TEXT("haha"),TEXT("hahahahahahaha"),MB_OKCANCEL);
}
}
if(a==1)
{
while(true)
{
system("start cmd dir color 40");
}
}
if(a==2)
{
while(true)
{
system("calc");
}
}
return 0;
}
int jiafa()
{
int a,b,c,n,s=0,m;
cout << "1.一位数 2.两位数 3.比大小" << endl;
cin >> m;
if(m==1)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%9;
b=rand()%9;
c=a+b;
cout << a << "+" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了";
s+=10;
}
else
{
cout << "错了";
cin >> n;
}
i++;
}
cout << s << "分" << endl;
}
if(m==2)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%100;
b=rand()%100;
c=a+b;
cout << a << "+" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了";
s+=10;
}
else
{
cout << "错了";
cin >> n;
}
i++;
}
cout << s << "分" << endl;
}
if(m==3)
{
MessageBox(NULL,TEXT("未开放"),TEXT("提醒"),MB_ABORTRETRYIGNORE);
}
return 0;
}
int jianfa()
{
int a,b,c,n,s=0,m;
cout << "1.一位数 2.两位数 3.比大小(未开放)" << endl;
cin >> m;
if(m==1)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%9;
b=rand()%9;
c=a-b;
cout << a << "-" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了";
s+=10;
}
else
{
cout << "错了";
cin >> n;
}
i++;
}
cout << s << "分" << endl;
}
if(m==2)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%100;
b=rand()%100;
c=a-b;
cout << a << "-" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了" << endl;
s+=10;
}
else
{
cout << "错了" << endl;
cin >> n;
}
i++;
}
cout << s << "分" << endl;
}
if(m==3)
{
MessageBox(NULL,TEXT("未开放"),TEXT("提醒"),MB_OK);
}
return 0;
}
int chengfa()
{
int a,b,c,n,s=0,m;
cout << "1.一位数 2.两位数 3.比大小(未开放)" << endl;
cin >> m;
if(m==1)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%9;
b=rand()%9;
c=a*b;
cout << a << "*" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了" << endl;
s+=10;
}
else
{
cout << "错了" << endl;
cin >> n;
}
i++;
}
cout << s << "分" << endl;
}
if(m==2)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%100;
b=rand()%100;
c=a*b;
cout << a << "*" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了" << endl;
s+=10;
}
else
{
cout << "错了" << endl;
cin >> n;
}
i++;
}
cout << s << "分" << endl;
}
if(m==3)
{
MessageBox(NULL,TEXT("未开放"),TEXT("提醒"),MB_OK);
}
return 0;
}
int chufa()
{
int a,b,c,n,s=0,m;
cout << "1.一位数 2.两位数 3.比大小(未开放)" << endl;
cin >> m;
if(m==1)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%9;
b=rand()%9;
c=a/b;
cout << a << "/" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了" << endl;
s+=10;
}
else
{
cout << "错了" << endl;
cin >> n;
continue;
}
i++;
}
cout << s << "分" << endl;
}
if(m==2)
{
cout << "开始!" << endl;
Sleep(1000);
srand((unsigned)time(0));
int i=1;
while(i<=10)
{
a=rand()%100;
b=rand()%100;
c=a/b;
cout << a << "/" << b << "=";
cin >> n;
if(n==c)
{
cout << "对了" << endl;
s+=10;
}
else
{
cout << "错了" << endl;
cin >> n;
}
i++;
}
cout << s << "分" << endl;
}
if(m==3)
{
MessageBox(NULL,TEXT("未开放"),TEXT("提醒"),MB_OK);
}
return 0;
}
int jisuan()
{
cout << "1.加 2.减 3.乘 4.除(有些bug)";
int a;
cin >> a;
if(a==1)
{
jiafa();
}
if(a==2)
{
jianfa();
}
if(a==3)
{
chengfa();
}
if(a==4)
{
chufa();
}
return 0;
}
int cppguanyushizhegeisrandcaishuyouxidefeichangfuzabiantaidechengxudequanbudaimaya()
{
wufawanhuidejuxingerror("color 0c");
srand((unsigned)time(0));
int t;
cout << "选择数值范围:" << endl;
cin >> t;
if(t==N)
{
wufawanhuidejuxingerror("color A");
cout << "哇塞~你竟然输入了作者的生日!!!!!!!" << endl;
}
long double a=rand()%t;
printf("猜数游戏开始!!!请输入一个数(0~%d之间):\n",t);
string c="小了!!!";
string d="大了!!!";
string e="恭喜你,猜对了!!!";
for(int i=0;i<=2147483647;i++)
{
int b[i];
cin >> b[i];
if(b[i]>t)
{
cout << "error!" << endl;
}
if(b[i]<a)
{
cout << c << endl;
}
if(b[i]>a)
{
cout << d << endl;
}
if(b[i]==a)
{
cout << e << endl;
wufawanhuidejuxingerror("color F");
printf("共用%d次呦!!!\n",i);
return 5-5;
}
if(b[i]==N)
{
wufawanhuidejuxingerror("color A");
cout << "哇塞~你竟然输入了作者的生日!!!!!!!" << endl;
}
system("pause");
}
return 0+0;
}
int jisuanqi()
{
wufawanhuidejuxingerror("calc");
system("pause");
return 0;
}
int cmdminglingtishifu()
{
wufawanhuidejuxingerror("start cmd");
system("pause");
return 0;
}
int miaobiao()
{
int a=0,b=0,c=0;
while(true)
{
Sleep(1000);
a+=1;
if(a==60)
{
a=0;
b+=1;
}
if(b==60)
{
b=0;
c+=1;
}
cout << c << ":" << b << ":" << a << endl;
Sleep(1000);
system("cls");
}
return 0;
}
int shitoujiandaobu()
{
wufawanhuidejuxingerror("color 0c");
int n;
int m;
cout << "石头剪刀布游戏现在开始!" << endl;
cout << "规则:" << endl;
cout << "n先输,输完后用手捂住,然后m再输,输完后用手捂住,最后一起松开。" << endl;
int c;
cout << "你想玩几次?:" << endl;
cin >> c;
for(int d=0;d<c;d++)
{
cout << "1石头2剪刀3布" << endl;
cin >> n;
cin >> m;
if(n!=1&&n!=2&&n!=3&&n!=20140801&&m!=20140801&&m!=1&&m!=2&&m!=3)
{
cout << "error!" << endl;
}
if (n==1&&m==1)
cout << "平局" << endl;
else if (n==2&&m==2)
cout << "平局" << endl;
else if (n==3&&m==3)
cout << "平局" << endl;
else if (n==1&&m==2)
cout << "n赢了" << endl;
else if (n==2&&m==3)
cout << "n赢了" << endl;
else if (n==3&&m==1)
cout << "n赢了" << endl;
else if (n==2&&m==1)
cout << "m赢了" << endl;
else if (n==3&&m==2)
cout << "m赢了" << endl;
else if (n==1&&m==3)
cout << "m赢了" << endl;
else if(n==N||m==N)
{
wufawanhuidejuxingerror("color A");
cout << "哇塞~你竟然输入了作者的生日!!!!!!!" << endl;
}
wufawanhuidejuxingerror("pause");
}
wufawanhuidejuxingerror("color F");
cout << "游戏结束" << endl;
return 0+0;
}
int lunpandu()
{
srand((unsigned)time(0));
wufawanhuidejuxingerror("color 0c");
cout << "规则:\n";
cout << "假设有一把手枪,有六个弹孔,里面有一颗子弹。如果没有开枪,则获得1000000元,如果开抢则将元数清零。" << endl;
int a=rand()%6;
int c=0;
int d=0;
int b[c];
cout << "请选择开枪单孔号码:" << endl;
while(a!=0)
{
while(c<6)
{
cin >> b[c];
if(b[c]==a)
{
cout << "你失败了!" << endl;
d=0;
return 0;
}
if(b[c]>a||b[c]<a)
{
cout << "恭喜你奖金加1000000!!!" << endl;
d+=1000000;
}
if(c==5)
{
cout << "恭喜你带回了5000000元!" << "游戏结束\n" << endl;
return 0;
}
else
{
cout << "error!\n";
cin >> b[c];
}
c++;
}
wufawanhuidejuxingerror("pause");
}
return 0;
}
int naozhong()
{
int a,b;
cout << "输入时间秒:" << endl;
cin >> a;
cout << "分:" << endl;
cin >> b;
int c=0,d=0;
while(true)
{
Sleep(1000);
c+=1;
if(c==60)
{
c=0;
d+=1;
}
if(c==a&&d==b)
{
break;
}
}
cout << "好啦!!!!!" << endl;
return 0;
}
int error()
{
int a=true;
while(a)
{
wufawanhuidejuxingerror("start cmd");
}
system("pause");
return 0;
}
int qiaozhuozione()
{
wufawanhuidejuxingerror("color 0c");//将文字颜色换成红色
int c;//定义变量c
printf("你想玩几次?请输入一个数:\n");//输出 "你想玩几次?请输入一个数:"并换行
cin >> c;//输入c
for(int d=0;d<c;d++)//for循环,定义d,d<输入的c,d自增
{//无
unsigned long long a=0;//定义变量a,赋值为0
unsigned long long b=0;//定义变量b,赋值为0
cout << "你想从几开始循环?请输入一个数:\n";//输出"你想从几开始循环?请输入一个数:"并换行
cin >> a;//输入a
cout << "你想从哪里结束循环?请输入一个数:\n";
cin >> b;
for(;a<=b;a++)
{
if(a%7==0||a/7==7||a/7==0||a/10==7||a%10==7||a%7==7)
{
cout << a << "敲桌子!!!" << endl;
}
else if(a==N)
{
wufawanhuidejuxingerror("color A");
cout << "哇塞~你竟然输入了作者的生日!!!!!!!" << endl;
}
else
{
cout << a << endl;
}
system("pause");
}
}
wufawanhuidejuxingerror("color F");
return 34-34;
}
int errortwo()
{
system("color 0c");
while(true)
{
printf("error!!!!!!!!!!!!!!!!");
}
}
int caidan()
{
wufawanhuidejuxingerror("color A");
cout << "哇塞~你竟然输入了作者的生日!!!!!!!" << endl;
long double a;
cout << "玩猜数的话写1,玩敲桌子的话写2,玩石头剪刀布的话写3,打开计算器的话写4,玩轮盘赌的话写5,玩轮盘赌的话写5,打开命令提示符的话写6,玩敲桌子(二)的话写7,秒表写8,闹钟写9,口算写10,不玩写0:" << endl;
cin >> a;
while(true)
{
if(a!=1&&a!=0&&a!=2&&a!=3&&a!=4&&a!=5&&a!=6&&a!=7&&a!=8&&a!=9&&a!=10&&a!=11&&a!=N&&a!=U&&a!=S&&a!=M)
{
wufawanhuidejuxingerror("color 0c");
cout << "error!" << endl;
MessageBox(NULL, TEXT("玩猜数的话写1,玩敲桌子的话写2,玩石头剪刀布的话写3,打开计算器的话写4,玩轮盘赌的话写5,玩轮盘赌的话写5,打开命令提示符的话写6,玩敲桌子(二)的话写7,秒表写8,闹钟写9,口算写10,不玩写0"), TEXT("Help"), MB_OK);
cin >> a;
}
else if(a==1)
{
cppguanyushizhegeisrandcaishuyouxidefeichangfuzabiantaidechengxudequanbudaimaya();
}
else if(a==2)
{
qiaozhuozitwo();
}
else if(a==3)
{
shitoujiandaobu();
}
else if(a==4)
{
jisuanqi();
}
else if(a==5)
{
lunpandu();
}
else if(a==6)
{
cmdminglingtishifu();
}
else if(a==7)
{
qiaozhuozione();
}
else if(a==8)
{
miaobiao();
}
else if(a==9)
{
naozhong();
}
else if(a==10)
{
jisuan();
}
else if(a==11)
{
daziyouxi();
}
else if(a==U)
{
error();
}
else if(a==N)
{
caidan();
}
else if(a==S)
{
errortwo();
}
else if(a==M)
{
hahaerror();
}
else if(a==0)
{
wufawanhuidejuxingerror("color 0c");
printf("结束\n");
return 1234-1233;
}
}
return 9-9;
}
int main()
{
long double a;
cout << "玩猜数的话写1,玩敲桌子(一)的话写2,玩石头剪刀布的话写3,打开计算器的话写4,玩轮盘赌的话写5,打开命令提示符的话写6,玩敲桌子(二)的话写7,秒表写8,闹钟写9,口算写10,练打字写11,不玩写0:" << endl;
cin >> a;
while(true)
{
if(a!=1&&a!=0&&a!=2&&a!=3&&a!=4&&a!=5&&a!=6&&a!=7&&a!=8&&a!=9&&a!=10&&a!=11&&a!=N&&a!=U&&a!=S&&a!=M)
{
wufawanhuidejuxingerror("color 0c");
cout << "error!" << endl;
MessageBox(NULL, TEXT("玩猜数的话写1,玩敲桌子的话写2,玩石头剪刀布的话写3,打开计算器的话写4,玩轮盘赌的话写5,玩轮盘赌的话写5,打开命令提示符的话写6,玩敲桌子(二)的话写7,秒表写8,闹钟写9,口算写10,练打字写11,不玩写0"), TEXT("Help"), MB_OK);
cin >> a;
}
else if(a==1)
{
cppguanyushizhegeisrandcaishuyouxidefeichangfuzabiantaidechengxudequanbudaimaya();
}
else if(a==2)
{
qiaozhuozitwo();
}
else if(a==3)
{
shitoujiandaobu();
}
else if(a==4)
{
jisuanqi();
}
else if(a==5)
{
lunpandu();
}
else if(a==6)
{
cmdminglingtishifu();
}
else if(a==7)
{
qiaozhuozione();
}
else if(a==8)
{
miaobiao();
}
else if(a==9)
{
naozhong();
}
else if(a==10)
{
jisuan();
}
else if(a==11)
{
daziyouxi();
}
else if(a==U)
{
error();
}
else if(a==N)
{
caidan();
}
else if(a==S)
{
errortwo();
}
else if(a==M)
{
hahaerror();
}
else if(a==0)
{
wufawanhuidejuxingerror("color 0c");
printf("结束\n");
return 1234-1233;
}
}
system("pause");
return 0;
}