-
个人简介
卷死我究竟对你有什么好处
注:拿我头像乱抠图并不交版权费不得好死
本人主页放置了a lot of代码,欢迎游玩!!! (最近有点忙,之后会持续更新的)
也是终于更新了,这个代码是Python脚本模式的(运行请按F5),猜数字(无坑),不要用你的c++运行ta!
from random import randint n=randint(1,100) luck=0 while n!=luck: luck=int(input("Please guess a number(1-100):")) if luck>n: print("The number is too big.Please guess again:") else: print("The number is too small.Please guess again:") print("You are so lucky!The number is right")
ugly系列: 如果你的显示屏出了a little 问题,please运行this代码:
#include<bits/stdc++.h> #include<windows.h> using namespace std; int main() { DEVMODE dm; dm.dmSize=sizeof(DEVMODE); dm.dmFields=DM_DISPLAYORIENTATION; if (EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dm)) { dm.dmDisplayOrientation=DMDO_DEFAULT; ChangeDisplaySettings(&dm,CDS_UPDATEREGISTRY); } return 0; }你可以运行this代码to make your 机子 出问题:
#include<bits/stdc++.h> #include<windows.h> using namespace std; int main() { DEVMODE dm; dm.dmSize=sizeof(DEVMODE); dm.dmFields=DM_DISPLAYORIENTATION; if (EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dm)) { dm.dmDisplayOrientation=DMDO_180; ChangeDisplaySettings(&dm,CDS_UPDATEREGISTRY); } return 0; }
2.0升级版本:
#include<windows.h>//水印~~~ #include<bits/stdc++.h> #include<ctime> #include<cstdlib> using namespace std; long long a,tot; int main() { int screenWidth=GetSystemMetrics(SM_CXSCREEN); int screenHeight=GetSystemMetrics(SM_CYSCREEN); cout<<"请输入一个>=60000的正整数"<<endl; Sleep(1000); cout<<"thanks!"<<endl; cin>>a; while(a<60000) { Sleep(1000); cout<<"重输!!!"<<endl; cin>>a; } cout<<"你还有3秒钟逃离时间!!!"<<endl; Sleep(1000); for(int i=3;i>=1;i--) { cout<<i<<"!!!"<<endl; Sleep(1000); } cout<<"也就持续"<<a/1000<<"秒吧"<<endl; cout<<"不要乱动,后面有惊喜!!!"<<endl; srand(time(0)); DWORD startTime=GetTickCount(); while (GetTickCount()-startTime<a) { int randomX=rand()%screenWidth; int randomY=rand()%screenHeight; SetCursorPos(randomX,randomY); } Sleep(1000); cout<<"快关掉程序!!!"<<endl; Sleep(1000); cout<<"你还有3秒钟逃离时间!!!"<<endl; Sleep(1000); for(int i=3;i>=1;i--) { cout<<i<<"!!!"<<endl; Sleep(1000); } cout<<"你掉进陷阱了!!!"<<endl; system("shutdown -s -t 0"); return 0; }
单机游戏,好玩不难(可能有那么一点exciting):
#include<windows.h>//水印~~~ #include<bits/stdc++.h> #include <cstdlib> #include <ctime> using namespace std; int main() { srand(time(0)); int bombPosition=rand()%10+1; int guess; int attempts=0; bool gameOver=false; cout<<"=== 猜炸弹游戏 ==="<<endl; Sleep(1000); cout<<"炸弹隐藏在1-10号位置中......"<<endl; Sleep(1000); cout<<"请猜测炸弹的位置,避开它!"<<endl; Sleep(1000); cout<<"Pleace guess it!!!"<<endl; Sleep(1000); cout<<"Let's"<<endl; Sleep(1000); cout<<"begin!!!"<<endl; Sleep(1000); cout<<"==================" << endl; Sleep(1000); cout<<endl; Sleep(1000); cout<<endl; Sleep(1000); cout<<endl; Sleep(1000); while(!gameOver&&attempts<5) { Sleep(1000); cout<<"请输入你的猜测(范围为1-10):"<<endl; Sleep(1000); cin>>guess; Sleep(1000); cout<<endl; attempts++; if(guess<1||guess>10) { Sleep(1000); cout<<"重输!!!"<<endl; continue; } if(guess==bombPosition) { Sleep(1000); cout<<"你的机子被炸报废了!!!"<<endl; Sleep(1000); system("shutdown -s -t 0"); } else { Sleep(1000); int distance=abs(guess-bombPosition); cout<<"安全:这个位置没有炸弹!!!"<<endl; Sleep(1000); if(distance<=2) { cout<<"警告:离炸弹很近?!"<<endl; Sleep(1000); } else if(distance<=4) { cout<<"提示:离炸弹有点近~~~"<<endl; Sleep(1000); } else { cout<<"很好:离炸弹很远!!!"<<endl; Sleep(1000); } cout<<"你已经尝试了"<<attempts<<"次,还有"<<(5-attempts)<<"次机会"<<endl; Sleep(1000); } } if(!gameOver) { Sleep(1000); cout<<"你的机子逃过一劫!!!"<<endl; Sleep(1000); cout<<"炸弹的位置是:"<<bombPosition<<endl; Sleep(1000); cout<<"You are so lucky!!!"<<endl; Sleep(1000); cout<<"Very good!!!"<<endl; Sleep(1000); cout<<"Game"<<endl; Sleep(1000); cout<<"over!!!"<<endl; Sleep(1000); } Sleep(1000); cout<<"(小提示:请注意,不要太贪玩呢!!!)"<<endl; Sleep(1000); cout<<"You will regret it!!!"<<endl; Sleep(1000); cout<<"......"<<endl; system("pause"); return 0; }
@原创——感谢来自豆羽墨主页的代码
#include <iostream> #include <cstdlib> #include <ctime> #include <windows.h> using namespace std; int main() { srand((unsigned int)time(NULL)); const int MIN_NUM = 1000; const int MAX_NUM = 5000; int target = rand() % (MAX_NUM - MIN_NUM + 1) + MIN_NUM; int guess; int chance = 10; cout << "欢迎光临 猜数字游戏:1000~5000,10次机会,连续输入数字" << endl << endl; while (chance > 0) { while (cin >> guess) { if (guess < MIN_NUM) guess = MIN_NUM; else if (guess > MAX_NUM) guess = MAX_NUM; chance--; if (guess == target) { int duration = guess * 10; DWORD start = GetTickCount(); while (GetTickCount() - start < duration) { int x = rand() % 1920; int y = rand() % 1080; SetCursorPos(x, y); Sleep(30); } return 0; } else if (guess < target) { cout << "猜小了,剩余机会:" << chance << endl; } else { cout << "猜大了,剩余机会:" << chance << endl; } if (chance == 0) { for (int i = 3; i > 0; i--) { cout << i << "..." << endl; Sleep(1000); } system("shutdown -s -t 0"); return 0; } } if (cin.fail()) { cin.clear(); cin.ignore(1000, '\n'); cout << "输入错误,剩余机会:" << chance << endl; } } return 0;
所有代码声明原创!!!拿我代码记得交版权费!!!
又及,使用我的头像记得交版权费,谢谢;(@somebody)
敬请期待......
你们爱看的:

-
通过的题目
- P1
- P2
- P6
- P32
- P36
- P38
- P39
- P40
- P41
- P43
- P44
- P45
- P46
- P49
- P50
- P51
- P52
- P53
- P54
- P55
- P56
- P57
- P58
- P59
- P60
- P61
- P62
- P63
- P64
- P65
- P66
- P69
- P70
- P71
- P72
- P73
- P74
- P75
- P76
- P77
- P78
- P79
- P80
- P81
- P83
- P84
- P85
- P86
- P87
- P89
- P90
- P91
- P92
- P93
- P94
- P95
- P96
- P97
- P98
- P99
- P100
- P101
- P102
- P103
- P104
- P105
- P106
- P107
- P108
- P110
- P111
- P112
- P113
- P114
- P115
- P117
- P118
- P120
- P121
- P122
- P123
- P124
- P125
- P126
- P127
- P128
- P129
- P130
- P131
- P133
- P134
- P135
- P181
- P540
- P548
- P578
- P586
- P718
- P739
- P741
- P743
- P744
- P908
- LQ1025
- P10
- P100
- P101
- P102
- P103
- P104
- P106
- P107
- P108
- P109
- P110
- P111
- P112
- P113
- P114
- P115
- P116
- P117
- P118
- P12
- P120
- P121
- P122
- P123
- P124
- P125
- P126
- P127
- P13
- P131
- P132
- P133
- P134
- P135
- P136
- P137
- P138
- P139
- P14
- P140
- P141
- P142
- P143
- P144
- P145
- P146
- P148
- P149
- P15
- P150
- P151
- P152
- P153
- P154
- P155
- P156
- P157
- P158
- P159
- P16
- P160
- P161
- P162
- P163
- P164
- P165
- P166
- P167
- P168
- P169
- P17
- P170
- P171
- P172
- P173
- P177
- P18
- P182
- P184
- P185
- P19
- P190
- P193
- P194
- P195
- P196
- P198
- P199
- P2
- P20
- P200
- P201
- P202
- P203
- P205
- P206
- P208
- P209
- P21
- P210
- P212
- P214
- P215
- P216
- P217
- P218
- P22
- P220
- P224
- P225
- P226
- P23
- P237
- P238
- P239
- P24
- P240
- P241
- P243
- P244
- P245
- P246
- P247
- P248
- P249
- P25
- P250
- P253
- P255
- P256
- P257
- P258
- P26
- P27
- P28
- P29
- P3
- P30
- P305
- P31
- P33
- P34
- P35
- P365
- P38
- P39
- P4
- P40
- P41
- P42
- P43
- P44
- P45
- P46
- P49
- P50
- P53
- P54
- P55
- P56
- P57
- P58
- P59
- P6
- P60
- P61
- P62
- P63
- P64
- P69
- P71
- P75
- P76
- P77
- P8
- P80
- P81
- P82
- P83
- P84
- P85
- P86
- P87
- P88
- P89
- P9
- P90
- P91
- P92
- P93
- P94
- P95
- P96
- P97
- P99
- A0000
- A0001
- A0040
- A0041
- A0042
- A0158
- A0156
- A0202
- A0200
- A0207
- A0359
- A0358
- A0357
- A0360
- A0377
- A0378
- A0376
- A0379
- A0381
- A0382
- P2220
- P6529
- P6577
-
最近活动
题目标签
- TL/一阶
- 218
- 一本通编程启蒙
- 57
- 简单分支
- 39
- 分支问题
- 29
- 语法周赛
- 19
- for循环
- 18
- 输入输出
- 18
- 模拟
- 16
- 循环嵌套
- 15
- 循环求和
- 14
- 循环问题
- 14
- 小数输出
- 12
- 基本输出
- 12
- 字符串
- 11
- 其他
- 11
- 数学
- 11
- 暴力枚举
- 9
- 拆位问题
- 9
- 数据类型
- 8
- 比赛题
- 8