📄 main.cpp
字号:
#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;
class CGame
{
int cur;
//* * 1 * *
public:
void Start()
{
cur = 0;
cout<<"Game Starting!!!!!"<<endl;
}
void Step(int t)
{
//* * 2 * *
if( )
{
cout<<"Input Error!"<<endl;
return;
}
srand((unsigned)time(0));
int s = rand()%10;
cout<<Info[s]<<endl;
s-= 3;
cur += (s*t);
if( cur <0)
{
cur = 0;
}
cout<<"当前在: "<<cur<<endl;
}
bool isWin()
{
if( cur == 100)
return true;
return false;
}
};
//* * 3 * *
=
{
"被迫倒退3",
"被迫倒退2",
"被迫倒退1",
"原地不动",
"前进1",
"前进2",
"前进3",
"前进4",
"前进5",
"前进6"
};
void main()
{
CGame obj;
do {
obj.Start();
do {
int t;
cout<<"please input a number(1-6): ";
cin>>t;
if( t == 0)
return ;
obj.Step(t);
}
//* * 4 * *
while( );
cout<<"WINNER!!!!!!"<<endl;
} while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -