- C++
把写完的代码放这(不是作业 是自己随便写的 c++)
- @ 2025-12-5 19:45:35
放吧!
3 条评论
-
-
#include <string.h> int main() { char answer[42]; strcpy(answer, "undefined will tell you the answer to life the universe and everything,"); strcpy(answer, "but first of all, she is very sorry that Hydro meets some issues now."); strcpy(answer, "please wait patiently, or contact undefined impatiently about this error."); return 0; }
-
MC中自动攻击
可以在刷怪塔等地方使用
攻击时间随机,不会被管理员发现
#include <iostream> #include <cstdlib> #include <ctime> #include <windows.h> #include <conio.h> using namespace std; double getRandomDelay() { return 0.6 + (rand() % 300) / 1000.0; } void simulateClick() { POINT currentPos; GetCursorPos(¤tPos); mouse_event(MOUSEEVENTF_LEFTDOWN, currentPos.x, currentPos.y, 0, 0); Sleep(50); mouse_event(MOUSEEVENTF_LEFTUP, currentPos.x, currentPos.y, 0, 0); } void randomMouseMove() { int screenWidth = GetSystemMetrics(SM_CXSCREEN); int screenHeight = GetSystemMetrics(SM_CYSCREEN); int centerX = screenWidth / 2; int centerY = screenHeight / 2; int offsetX = (rand() % 101) - 50; int offsetY = (rand() % 101) - 50; SetCursorPos(centerX + offsetX, centerY + offsetY); } int main() { srand(static_cast<unsigned>(time(0))); cout << "随机点击模拟器启动" << endl; cout << "点击间隔: 0.6-0.9秒随机" << endl; cout << "鼠标在屏幕中心±50像素范围内随机移动" << endl; cout << "按Ctrl+C终止程序" << endl; char key; int clickCount = 0; bool running = true; while (running) { cout << "点击已开启" << endl; while (true) { double delay = getRandomDelay(); double actualDelay = delay + (rand() % 50) / 1000.0; Sleep(static_cast<DWORD>(actualDelay * 1000)); randomMouseMove(); simulateClick(); clickCount++; cout << "第" << clickCount << "次点击完成,间隔: " << actualDelay << "秒" << endl; if (clickCount % 10 == 0) { cout << "已执行" << clickCount << "次点击,继续运行中..." << endl; } if (_kbhit()) { key = _getch(); if (key >= 'a' && key <= 'z') key -= 32; if (key == 'T') { cout << "点击已关闭" << endl; break; } } } Sleep(1000); // 等待重新开始 cout << "按T键重新开始,按Q键退出" << endl; while (true) { if (_kbhit()) { key = _getch(); if (key >= 'a' && key <= 'z') key -= 32; if (key == 'T') { cout << "点击已重新开启" << endl; break; } else if (key == 'Q') { running = false; break; } } } } cout << "程序已退出" << endl; return 0; }
- 1