闲话#2:体育之乒乓大战1.0
sunqihuan
·
·
闲话
和小伙伴赌赌球吧!
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
/*
1.短球
2.长球
3.擦边
4.擦网
5.扣球
6.上旋
7.下旋
*/
string c[15]={"","短球","长球","擦边","擦网","扣球","上旋","下旋"};
int t;
void f(bool now,int last){
int r=0;
if(last==-1){
r=rand()%7+1;
if(r==4){
cout<<"发球擦网,换方重发!\n";
Sleep(t);
f(now==0?1:0,-1);
}
if(now==true)cout<<"红方打出";
else cout<<"蓝方打出";
cout<<c[r]<<endl;
Sleep(t);
f(now==0?1:0,r);
}
// if(last==1){
r=rand()%20;
if(r==2){
cout<<"哎呀!";
if(now==true)cout<<"红方";
else cout<<"蓝方";
cout<<"没有接到";
if(now==0?1:0==true)cout<<"红方";
else cout<<"蓝方";
cout<<"打出来的"<<c[last]<<endl;
Sleep(t);
if(now==0?1:0==true)cout<<"红方";
else cout<<"蓝方";
cout<<"获胜!!!\n";
exit(0);
}else{
/*
if(now==true)cout<<"红方";
else cout<<"蓝方";
cout<<"向前够!\n";
Sleep(t);
*/
if(now==true)cout<<"红方";
else cout<<"蓝方";
cout<<"接到了";
if(now==0?1:0==true)cout<<"红方";
else cout<<"蓝方";
cout<<"打出来的"<<c[last]<<endl;
Sleep(t);
cout<<"漂亮!";
if(now==true)cout<<"红方";
else cout<<"蓝方";
cout<<"以一个";
r=rand()%7+1;
cout<<c[r]<<"回敬";
if(now==0?1:0==true)cout<<"红方";
else cout<<"蓝方";
cout<<endl;
Sleep(t);
f(now==0?1:0,r);
}
// }
}
int main(){
cin>>t;
system("cls");
srand(time(0));
f(1,-1);
return 0;
}