Brains Games
我直接把源代码放上去了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| #include<iostream> #include<ctime> #include<windows.h> #include<stdlib.h> #include<cstdlib> int money = 50; int i = 0; using namespace std; void chushihua() {
cout << "正在加载程序."; Sleep(1000); cout << "."; Sleep(1000); cout << "."; cout << endl; } void note() { cout << "说明:"; cout << endl; Sleep(500); cout << "本程序基于C++14"; cout << endl; Sleep(500); cout << "首先,你有50元钱,每一次抽奖如果没中,将会扣5元"; cout << endl; Sleep(500); cout << "反之,中了奖就会加10元"; Sleep(500); cout << endl; Sleep(2000); system("cls"); } int main() { chushihua(); note(); while (money>0) { cout << "钱数 = "<<money<<"元"; cout << endl; int n = 0; int a = 0; cout << "抽奖程序" << endl; cout << "请输入1-5中的任意整数:"; cin >> n; srand(time(0)); a = rand() % 5 + 1; if (n == a) { cout << "恭喜您,中奖了,奖金10元"; cout << endl; money = money + 10; } else { cout << "没中奖,请付费5元"; cout << endl; cout << "中奖号码是:"; cout << a; cout << endl; money = money - 5; } i++; Sleep(2000); system("cls"); } cout << "您破产了"; cout << endl; cout << "您运行的次数: " << i; cout << endl; system("pause"); return 0; }
|
我把exe
放到 https://hydro.ac/上了
想要的自己点https://hydro.ac/file/3760/%E6%8A%BD%E5%A5%96.exe
源代码也放上面https://hydro.ac/file/3760/%E6%8A%BD%E5%A5%96.zip
自己点
洛谷ID:Jason_Zhou