- 长方形面积计算
立新3.11讨论群
- 2025-6-26 12:18:02 @
#include <iostream>
using namespace std;
int main() {
cout << "Welcome!" << endl;
return 0;
}
6 条评论
-
马铭泽 @ 2025-7-13 15:59:14
HI,在吗?
👍 1 -
2025-7-12 17:35:37@
你们在吗?
-
2025-6-26 12:29:24@
#include<iostream> #include<cstdlib> #include<ctime> #include <windows.h> using namespace std; void functionWithoutArgs(){ system("color 9f"); char v; int l, n = 6; // 初始化剩余抽奖次数为6 cout<<"欢迎来玩抽奖游戏!!!"<<endl; // 只在游戏开始时显示一次提示信息 cout<<"有奖有罚,罚多奖少!"<<endl; // 修改提示语,突出惩罚项增加 // 使用循环控制抽奖次数 while(n > 0){ cout<<"还可抽"<< n <<"次"<<endl ; cout<<"请输入抽奖次数和任意字符开始游戏(抽奖次数建议为12-372之间)"<<endl; // 验证输入的抽奖次数是否为有效整数 while(!(cin >> l)) { cout << "错误:请输入有效的整数作为抽奖次数!" << endl; cin.clear(); cin.ignore(10000, '\n'); } // 读取并丢弃用户输入的任意字符 cin >> v; cout << "抽奖动画开始:" << endl; // 重置v为'a'开始动画效果 v = 'a'; for(int i = 1; i <= l; ++i){ ++v; cout << v << " "; if(v == 'z'){ v = 'a'; } Sleep(0.8); // 使用Windows API的Sleep函数 } cout << endl; // 奖项判定 cout << "=== 抽奖结果 ===" << endl; // 只在程序开始时初始化一次随机数种子 static bool seedInitialized = false; if (!seedInitialized) { srand(static_cast<unsigned int>(time(0))); seedInitialized = true; } int randomNum = rand() % 100; // 奖项判定逻辑 - 增加更多不好的奖项 if(randomNum < 1) { // 1% cout << "恭喜您获得传说级大奖!!!" << endl; cout << "奖品:私人太空旅行体验券!" << endl; } else if(randomNum < 3) { // 2% cout << "恭喜您获得特等奖!!!" << endl; cout << "奖品:豪华环球旅行套餐!" << endl; } else if(randomNum < 6) { // 3% cout << "恭喜您获得一等奖!!" << endl; cout << "奖品:最新款旗舰笔记本电脑!" << endl; } else if(randomNum < 10) { // 4% cout << "恭喜您获得二等奖!" << endl; cout << "奖品:高端机械键盘套装!" << endl; } else if(randomNum < 15) { // 5% cout << "您获得了幸运奖!" << endl; cout << "奖品:100元购书券!" << endl; } else if(randomNum < 20) { // 5% cout << "您获得了普通奖..." << endl; cout << "奖品:纪念徽章一枚。" << endl; } else if(randomNum < 25) { // 5% cout << "手气一般般..." << endl; cout << "惩罚:帮朋友做一件小事!" << endl; } else if(randomNum < 30) { // 5% cout << "手气不太好..." << endl; cout << "惩罚:打扫卫生一次!" << endl; } else if(randomNum < 35) { // 5% cout << "运气欠佳..." << endl; cout << "惩罚:整理房间一小时!" << endl; } else if(randomNum < 40) { // 5% cout << "运气不太好哦..." << endl; cout << "惩罚:做十道数学题!" << endl; } else if(randomNum < 45) { // 5% cout << "不太走运..." << endl; cout << "惩罚:唱一首儿歌!" << endl; } else if(randomNum < 50) { // 5% cout << "有点倒霉..." << endl; cout << "惩罚:做20个深蹲!" << endl; } else if(randomNum < 55) { // 5% cout << "运气不太好..." << endl; cout << "惩罚:写一篇短文!" << endl; } else if(randomNum < 60) { // 5% cout << "比较倒霉..." << endl; cout << "惩罚:给朋友讲一个冷笑话!" << endl; } else if(randomNum < 65) { // 5% cout << "非常遗憾..." << endl; cout << "惩罚:明天早起跑步!" << endl; } else if(randomNum < 70) { // 5% cout << "厄运降临..." << endl; cout << "惩罚:完成一项小挑战!" << endl; } else if(randomNum < 75) { // 5% cout << "超级倒霉!" << endl; cout << "惩罚:连续三天早起!" << endl; } else if(randomNum < 80) { // 5% cout << "衰神附体!" << endl; cout << "惩罚:一周内每天早睡半小时!" << endl; } else if(randomNum < 85) { // 5% cout << "运气极差!" << endl; cout << "惩罚:为家人做一顿饭!" << endl; } else if(randomNum < 90) { // 5% cout << "背运时刻!" << endl; cout << "惩罚:清理手机相册和文件!" << endl; } else if(randomNum < 95) { // 5% cout << "灾厄临头!" << endl; cout << "惩罚:整理电脑桌面和文件夹!" << endl; } else { // 5% cout << "霉运缠身!" << endl; cout << "惩罚:给陌生人一个真诚的赞美!" << endl; } // 减少剩余抽奖次数 n--; // 抽奖之间添加分隔线,提高可读性 if(n > 0) { cout << "\n----------------------------------------\n"; } } cout << "\n抽奖次数已用完,感谢参与!" << endl; } int main(){ functionWithoutArgs(); return 0; }
-
2025-6-26 12:21:10@
我是不是有病
-
2025-6-26 12:21:00@
#include<bits/stdc++.h> #include<windows.h> using namespace std; int main(){ long long a=2; system("color 2f"); for(int o=0;o<=5;++o){ if(a==0) cout<<"\n抽奖次数已用完,感谢参与!"; printf("==抽奖游戏==\n欢迎来玩抽奖游戏!\n输入一个2000内整数一个空格一个a到m的字母\n有奖有罚!\n您有%lld次机会\n请抽奖:\n",a+1); long long l; char v; cin>>l>>v; for(int i=1;i<=l;++i){ cout<<v<<" "; Sleep(0.9999999999999986); ++v; if(v=='n') v='a'; } if(v=='a') cout<<"真挺好"<<" "<<"我讲两个笑话"; if(v=='b') cout<<"运气不好"<<" "<<"大嘴巴子"; if(v=='c') cout<<"运气特不好"<<" "<<"戳你的心"; if(v=='d'){ cout<<"还行"<<" "<<"再来一"; ++a; } if(v=='i') cout<<"挺好"<<" "<<"借书一天"; if(v=='e') cout<<"很遗憾"<<" "<<"空"; if(v=='f') cout<<"运气不好"<<" "<<"二十个蹲起"; if(v=='g') cout<<"运气不好"<<" "<<"蛙跳10次"; if(v=='h') cout<<"运气好"<<" "<<"看我跳舞"; if(v=='j') cout<<"跳舞"; if(v=='k') cout<<"运气特不好"<<" "<<"骂自己"; if(v=='l') cout<<"运气不好"<<" "<<"装自己可爱"; if(v=='m'){ cout<<"还行"<<" "<<"再来一"; ++a; } cout<<"\n"; --a; } return 0; } //抽奖游戏
-
2025-6-26 12:20:27@
***~~~> - 1. - [ ] ```| | col | col | col | col | col | col | | - | - | - | - | - | - | | content | content | content | content | content | content | | content | content | content | content | content | content | | content | content | content | content | content | content | | content | content | content | content | content | content | | col | col | | - | - | - | | content | content | content | | content | content | content |
~~~*</u>**
- 1
信息
- ID
- 1202
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者