作业帮 > 综合 > 作业

求程序,下面是剪刀石头布的程序,谁能帮忙改成能选择三局两胜,五局三胜……的?能成功运行的加分

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/15 19:30:53
求程序,下面是剪刀石头布的程序,谁能帮忙改成能选择三局两胜,五局三胜……的?能成功运行的加分
#include
#include
using namespace std;
class Play
{
public:
int People;
unsigned long Computer;
public:
Play(){};
Play(){};
void Set_People(int _p)
{
People=_p;
}
void Set_Computer(unsigned long _C)
{
Computer=_C;
}
int Judge()
{
switch(People)
{
case 0:
cout
#include
#include
using namespace std;
class Play
{
public:
int People;
unsigned long Computer;
public:
Play(){};
~Play(){};
void Set_People(int _p)
{
People=_p;
}
void Set_Computer(unsigned long _C)
{
Computer=_C;
}
int Judge()
{
switch(People)
{
case 0:
cout
再问: 能不能改成能选择的啊,选择三局两胜,五局三胜....................就是随便自己多少局地?
再答: // 只需要修改main() //#define AllCount 5 // 输入你要选择的赛制,5为五局三胜,3为三局两胜 //#define WinCount AllCount / 2 + 1 void main() { Play play; int a=5; int failure=0,win=0,tie=0; unsigned long begin; int WinCount; int AllCount; printf("输入你要选择的赛制:(请输入大于1的奇数)"); while(1) { scanf("%d", &AllCount); if(AllCount < 3 || AllCount % 2 == 0) { printf("输入错误,请重新输入!\n"); printf("输入你要选择的赛制:(请输入大于1的奇数)"); } else { break; } } WinCount = AllCount / 2 + 1; while(a!=-1) { begin=GetTickCount(); cout