吊死人小游戏2.0版本(4位数字版)
void gui1(int x)
{
if(x==1)
{
printf(" * \n");
}
if(x==2)
{
printf(" * \n"
" * * \n");
}
if(x==3)
{
printf(" * \n"
" * * \n"
"* *\n");
}
if(x==4)
{
printf(" * \n"
" * * \n"
"* *\n"
" * * \n");
}
if(x==5)
{
printf(" * \n"
" * * \n"
"*0 0*\n"
" * * \n");
}
if(x==6)
{
printf(" * \n"
" * * \n"
"*0 0*\n"
" *-* \n");
}
if(x==7)
{
printf(" * \n"
" * * \n"
"*0 0*\n"
"|*-*|\n");
}
}
void gui2(int x)
{
if(x==1)
{
printf(" | \n");
}
if(x==2)
{
printf(" | \n"
" - - \n");
}
if(x==3)
{
printf(" | \n"
" - - \n"
" | |\n");
}
if(x==4)
{
printf(" | \n"
" - - \n"
" | |\n");
}
if(x==5)
{
printf(" | \n"
" - - \n"
" | | \n"
" - - \n");
}
}
void gui3(int x)
{
if(x==1)
{
printf(" O \n");
}
if(x==2)
{
printf(" O \n"
" | \n");
}
if(x==3)
{
printf(" O \n"
" /|/ \n");
}
if(x==4)
{
printf(" O \n"
" /|/ \n"
" // \n");
}
if(x==5)
{
printf(" O \n"
" --- \n"
" /|/ \n"
" // \n");
}
}
void gui4(int x)
{
if(x==1)
{
printf(
" ********\n"
" ************\n"
" ####....#.\n"
" #..###.....##....\n"
" ###.......###### ### ###\n"
" ........... #...# #...#\n"
" ##*####### #.#.# #.#.#\n"
" ####*******###### #.#.# #.#.#\n"
" ...#***.****.*###.... #...# #...#\n"
" ....**********##..... ### ###\n"
" ....**** *****....\n"
" #### ####\n"
" ###### ######\n"
"##############################################################\n"
"#...#......#.##...#......#.##...#......#.##------------------#\n"
"###########################################------------------#\n"
"#..#....#....##..#....#....##..#....#....#####################\n"
"########################################## #----------#\n"
"#.....#......##.....#......##.....#......# #----------#\n"
"########################################## #----------#\n"
"#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n"
"########################################## ############\n"
);
}
}//额实在编不出人物了
void beidiao(int x,int s)//x为被吊人物被画的次数,s为选择的人物
{
if(s==1)//人物1
{
gui1(x);
}
else
{
if(s==2)//人物2
{
gui2(x);
}
else
{
if(s==3)//人物3
{
gui3(x);
}
else
{
gui4(x);//人物4
}
}
}
}
int s;//用来存放玩家选择的人物
int ss;//用来存放选择人物的笔画数量
cout<<"请选择被吊人物:1.作者的朋友(7画) 2.阿巴阿巴(5画) 3.普通的小人(5画) 4.*****(1画)"<<endl;//初始输出人物选择
cin>>s; //输入选择的人物
if(s==1)//按照选择人物编号给ss赋值
{
ss=7;
}
else
{
if(s==2||s==3)
{
ss=5;
}
else
{
ss=1;
}
}
将:gui(sigui)
改为:beidiao(sigui,s);
将:if(sugui==7)
改为:if(sigui==ss)
cout<<"QAQ\n"; //失败
cout<<"(^-^)V\n";//胜利
gui函数:
源代码丢失······
因为gui函数是针对单一的被吊人物,所以为了让程序具有本次更新的功能,不得将gui函数删除,由:gui1,gui2,gui3,gui4替代。
#include
using namespace std;
struct youxi{
char shuchu;
int daan;
}a[100];
int sigui;
char shuru;
int ans=4;
bool flag,fl;
int bo;
int s;
int ss;
void make()
{
srand((unsigned)time(NULL));
for(int i=1;i<=4;i++)
{
a[i].daan=rand()%10;
a[i].shuchu='?';
}
sigui=0;
cout<<"请选择被吊人物:1.作者的朋友(7画) 2.阿巴阿巴(5画) 3.普通的小人(5画) 4.*****(1画)"<<endl;
cin>>s;
if(s==1)
{
ss=7;
}
else
{
if(s==2||s==3)
{
ss=5;
}
else
{
ss=1;
}
}
}
void gui1(int x)
{
if(x==1)
{
printf(" * \n");
}
if(x==2)
{
printf(" * \n"
" * * \n");
}
if(x==3)
{
printf(" * \n"
" * * \n"
"* *\n");
}
if(x==4)
{
printf(" * \n"
" * * \n"
"* *\n"
" * * \n");
}
if(x==5)
{
printf(" * \n"
" * * \n"
"*0 0*\n"
" * * \n");
}
if(x==6)
{
printf(" * \n"
" * * \n"
"*0 0*\n"
" *-* \n");
}
if(x==7)
{
printf(" * \n"
" * * \n"
"*0 0*\n"
"|*-*|\n");
}
}
void gui2(int x)
{
if(x==1)
{
printf(" | \n");
}
if(x==2)
{
printf(" | \n"
" - - \n");
}
if(x==3)
{
printf(" | \n"
" - - \n"
" | |\n");
}
if(x==4)
{
printf(" | \n"
" - - \n"
" | |\n");
}
if(x==5)
{
printf(" | \n"
" - - \n"
" | | \n"
" - - \n");
}
}
void gui3(int x)
{
if(x==1)
{
printf(" O \n");
}
if(x==2)
{
printf(" O \n"
" | \n");
}
if(x==3)
{
printf(" O \n"
" /|/ \n");
}
if(x==4)
{
printf(" O \n"
" /|/ \n"
" // \n");
}
if(x==5)
{
printf(" O \n"
" --- \n"
" /|/ \n"
" // \n");
}
}
void gui4(int x)
{
if(x==1)
{
printf(
" ********\n"
" ************\n"
" ####....#.\n"
" #..###.....##....\n"
" ###.......###### ### ###\n"
" ........... #...# #...#\n"
" ##*####### #.#.# #.#.#\n"
" ####*******###### #.#.# #.#.#\n"
" ...#***.****.*###.... #...# #...#\n"
" ....**********##..... ### ###\n"
" ....**** *****....\n"
" #### ####\n"
" ###### ######\n"
"##############################################################\n"
"#...#......#.##...#......#.##...#......#.##------------------#\n"
"###########################################------------------#\n"
"#..#....#....##..#....#....##..#....#....#####################\n"
"########################################## #----------#\n"
"#.....#......##.....#......##.....#......# #----------#\n"
"########################################## #----------#\n"
"#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n"
"########################################## ############\n"
);
}
}
void beidiao(int x,int s)
{
if(s==1)
{
gui1(x);
}
else
{
if(s==2)
{
gui2(x);
}
else
{
if(s==3)
{
gui3(x);
}
else
{
gui4(x);
}
}
}
}
void zhixing()
{
flag=fl=0;
for(int i=1;i<=4;i++)
{
cin>>shuru;
if(a[i].shuchu!='?')
{
continue;
}
if(shuru==a[i].daan+'0')
{
a[i].shuchu=shuru;
ans--;
fl=1;
}
else
{
flag=1;
}
}
if(fl==1)
{
flag=0;
}
if(flag==1)
{
sigui++;
}
beidiao(sigui,s);
}
void shuchu()
{
zhixing();
if(sigui==0)
{
cout<<"\n\n\n\n\n";
}
if(sigui==ss)
{
bo=1;
return;
}
if(ans==0)
{
bo=-1;
return;
}
for(int i=1;i<=4;i++)
{
cout<<a[i].shuchu;
}
cout<<endl;
}
int main()
{
make();
while(1)
{
shuchu();
if(bo==1)
{
cout<<"QAQ\n";
return 0;
}
else
{
if(bo==-1)
{
cout<<"(^-^)V\n";
return 0;
}
}
}
return 0;
}