0
点赞
收藏
分享

微信扫一扫

读心术(代码原创)

菜菜捞捞 2022-05-02 阅读 21
c++

话不多说直接上代码!

#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
char ch;
char b[5];
int c[5];
void menu()
{
system("color F0");
cout<<setw(80)<<"读心术 2.0"<<endl;
cout<<setw(80)<<"A开始游戏"<<endl<<endl;
cout<<setw(82)<<"B秘密(不要看)"<<endl<<endl;
cout<<setw(80)<<"C退出游戏"<<endl;
do {
ch=getch();
} while(ch<'A'||ch>'C');
}
void canditon()
{
system("cls");
system("color 30");
string a[5];
int i,j;
a[0]="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15";
a[1]="1,3,5,7,9,11,13,15";
a[2]="2,3,6,7,10,11,14,15";
a[3]="4,5,6,7,12,13,14,15";
a[4]="8,9,10,11,12,13,14,15";
for(i=1;i<=3;i++) {
cout<<"初始化中";
for(j=1;j<=6;j++) {
cout<<'.';
Sleep(380);
}
system("cls");
}
system("color DF");
cout<<"你从下面选一个数字,并且记在心里\n";
cout<<a[0]<<endl;
system("pause");
for(i=1;i<=4;i++)
{
system("cls");
cout<<i<<"问:下面的数中有吗?\nA.有 B.没有\n";
cout<<a[i]<<endl;
do
{
b[i]=getch();
} while(b[i]!='A''B');
if(b[i]=='A') c[i]=1;
else c[i]=0;
}
system("cls");
int ans=c[4]*8+c[3]*4+c[2]*2+c[1];
cout<<"你猜的数:"<<ans<<endl;
system("pause");
}
void difator()
{
MessageBox(0,"四次我可以猜出你想的数,如果不行的话,我倒立吃屎\n\t\t\t\t\t————minecraft大神","秘密",3);
}
int main() {
while(1)
{
menu();
switch(ch) {
case 'A':
canditon();
break;
case 'B':
difator();
break;
case 'C':
goto FLAG;
break;
}
system("cls");
}
FLAG:
return 0;
}
/*
0 = 黑色 8 = 灰色
1 = 蓝色 9 = 淡蓝色
2 = 绿色 A = 淡绿色
3 = 浅绿色 B = 淡浅绿色
4 = 红色 C = 淡红色
5 = 紫色 D = 淡紫色
6 = 黄色 E = 淡黄色
7 = 白色 F = 亮白色
*/
举报

相关推荐

0 条评论