xin.cpp
来自「一个用C++做的小游戏-赌博游戏,很简单.有SHOWHAND,玩色子等.对初学C」· C++ 代码 · 共 49 行
CPP
49 行
#include "head.h"
void func3()
{system("cls");
char a;int n1=0,n2=0,n3=0;//a 为储存字符的变量,n1,n2,n3为限定输入的次数。
cout<<"please,guess the english word of three letter"<<endl;
cout<<"Matched all,$10000for gift"<<endl;
cout<<"please,guess the first letter"<<endl;
a=getchar();
while(a!='c'&&a!='C')
{cout<<"try again"<<n1++<<endl;
a=getchar();//输入一个字符
if(n1>5)
{cout<<"you loss the change"<<endl;
exit(0);}
a=getchar();
}
a=getchar();
if(a=='c'||a=='C')
cout<<"you are lucky"<<endl;
cout<<"Then guess the second letter"<<endl;
a=getchar();
while(a!='e'&&a!='E')
{cout<<"try again"<<n2++<<endl;
a=getchar();
if(n2>5)
{cout<<"you loss the change"<<endl;
exit(0);}
a=getchar();}
a=getchar();
if(a=='e')
cout<<"you are lucky"<<endl;
cout<<"Then guess the last letter"<<endl;
a=getchar();
while(a!='o'&&a!='O')
{cout<<"try again"<<n3++<<endl;
if(n3>5)
{cout<<"you loss the change"<<endl;
exit(0);}}
a=getchar();
if(a=='o')
cout<<"you get it"<<endl;
cout<<"the word is ceo"<<'\n'<<"your account is added $10000"<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?