#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
while(1)
{
unsigned char ch[3]="",c;
int j,sum = 0,t;
cout << endl
<< " *************************************************************** " << endl
<< " **************** 猜 字 小 魔 术 ***************** " << endl
<< " *************************************************************** " << endl;
ch[0] = 0XB0;
for(int k=0;k<6;k++)
{
t = 0X1 << k;
cout << endl << endl
<< " *************************************************************** " << endl;
j=0;
for(int i=0;i<128;i++)
{
ch[1] = 0X80 | i;
if(ch[1]&t)
{
if(j%8==0)cout << endl;
cout << " " << ch << " ";
j++;
}
}
cout << endl << endl
<< " *************************************************************** "
<< endl << endl;
if(0 == k)
cout << " 请记住其中的一个字,然后按Y或y " << endl << endl;
else
cout << " 请问你记住的字在这里吗?"<<endl
<< " 是请按Y或y,否则按N或n,游戏继续。"<< endl << endl;
cout << " 请选择: " ;
cin >> c ;
if(c == 'Y' || c == 'y') {
sum += 0x1 << k;
}
system("cls");
}
ch[1] = 0xc0 | sum;
cout << endl
<< " *************************************************************** " << endl << endl
<< " 你记住的字是:" << ch << endl <<endl
<< " *************************************************************** " << endl << endl
<< " 是否继续?(按Y或y继续) " << endl
<< " 请选择: " ;
cin >> c ;
if( !(c == 'Y' || c == 'y'))return 0;
system("cls");
}
return 0;
}
C语言猜字游戏
最新推荐文章于 2024-04-21 16:14:03 发布