C++姓名大作战

姓名大作战

#include<iostream>

#include<windows.h>

#include<time.h>

#include<stdlib.h>

#include<stdio.h>

using namespace std;

//

//

//

//

//

// struct player { char name [20]; int hp; }play[2]={{"",1000},{"",1000}}; struct zhaoshi { }; player person1; char miaoshu[100]; player person2;

int panduan(int a)

{

}

void zhaoshifadong(player a,player b,int c)

{

if(c==0) srand(time(0)); int t=rand()%a; return t;

cout<<a.name<<"阴测测的笑了几声,亮出了自己的九阴排骨手,带着风声向"<<b.name<<"插去"<<endl;

else if(c==1)

cout<<a.name<<"突然从背后取出一物件,竟是一个MP4,里面播放着MP3,MP4正砸向"<<b.name<<"头顶"<<endl;

else if(c==2)

cout<<a.name<<"对着"<<b.name<<"眉来眼去,笑颜如花,竟是失传已久的郎情妾意剑"<<endl;

}

void zhaoshijieguo(player &a,player &b,int c)

{

if(c==0) { } else if(c==1) { } else if(c==2)

cout<<a.name<<"的攻击竟然被"<<b.name<<"招架住了,不可思议呀cout<<a.name<<"迎头击中"<<b.name<<endl; b.hp-=200; cout<<a.name<<"正好击中"<<b.name<<endl; b.hp-=100;

"<<endl;

else if(c==3)

}

void jieguomiaoshu(player a,player b)

{

for(int i=0;i<=1;i++) { if(a.hp>900 ) { cout<<a.name<<"的攻击被反击了"<<b.name<<"得意洋洋"<<endl; a.hp-=100; }

段"<<endl; }

"<<endl; }

"<<endl;

"<<endl;

{cout<<a.name<<"看起来气色不错,不时拿出毛主席语录朗诵一 //printf("%d\n",a.hp); else if(a.hp>700) {cout<<a.name<<"的额头已有不少汗珠,看来一时难以取胜 //printf("%d\n",a.hp); else if(a.hp>500) { cout<<a.name<<"不禁狂吐不止,一个不留神将肝吐了一地 //printf("%d\n",a.hp); } else if(a.hp>200) { cout<<a.name<<"受伤过重,鲜血不断涌出,随时可能摔倒 //printf("%d\n",a.hp); } else if(a.hp>0) { cout<<a.name<<"几乎挂掉了"<<endl; //printf("%d\n",a.hp); } player c; c=a; a=b; b=c;

}

}

int main()

{

cout<<"请输入你的名字:"<<endl; cin>>play[0].name ;

cout<<"请输入你朋友的名字"<<endl;

} cin>>play[1].name ; while(play[0].hp>0&&play[1].hp>0) { int n=panduan(3); //cout<<n<<endl; //检查随机数是否相同 zhaoshifadong(play[0],play[1],n); Sleep(5000); int m=panduan(4); //cout<<n<<endl; //检查随机数是否相同 zhaoshijieguo(play[0],play[1],m); Sleep(5000); jieguomiaoshu(play[0],play[1]); Sleep(5000); cout<<endl; cout<<endl; player c; c=play[0]; play[0]=play[1]; play[1]=c;

return 0;

}

 

第二篇:姓名大战

姓名大战

相关推荐