欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 名人名企 > C++彩票抽奖机

C++彩票抽奖机

2025/4/21 20:16:20 来源:https://blog.csdn.net/C13256134687/article/details/140755147  浏览:    关键词:C++彩票抽奖机

C++彩票机代码实现

#include <bits/stdc++.h>
#include <windows.h>
#include <ctime> 
#include<cstdlib>using namespace std;void ccc(string s) {for(int i = 0; i < s.size(); i++) {cout << s[i];Sleep(25);}cout << "\n";
}int main() {system("color 06");srand((unsigned)time(NULL));ccc("     欢迎进入彩票生成系统!");ccc("        奖金最高888积分!");cout << "\n\n\n"; ccc("          你要几张?");cout << "              ";int a;cin >> a;int s = 0;while(a--) {cout << "\n";ccc("       彩票正在生成中……"); cout << "\n";Sleep(500);int n = rand() % 20 + 1;cout << "中奖序号" << n;cout << "\n\n\n";for(int i = 1; i <= 8; i++) {int x = ((rand() % 200 + 1) / 50 + 1) * 5;int y = rand() % 20 + 1;printf("序号:%d 奖金:%d\n\n", y, x);if(y == n) s += x;Sleep(1000); }} printf("奖金:%d元!", s);Sleep(10 * 1000);
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词