跳到正文

个人记录

dyaXP系统

zhuyucheng6046约 22 分钟
原文
文章信息与版本

文章信息

发布
2025年2月9日
收录
2025年12月12日
更新
2026年11月17日
篇幅
约 22 分钟

版本

  1. v1当前

代码:

C++
#include <iostream>
#include <dirent.h>
#include <windows.h>
#include <codecvt> // 用于宽字符转换
#include <locale>
#include <fstream>
#include<bits/stdc++.h>
#include <filesystem>
#include <iostream>
#include <string>
#include <windows.h>
#include <iostream>
#include <vector>
#include <string>
#include<bits/stdc++.h>
#include <fstream>
#include <iostream>
#include <string>
namespace fs = std::filesystem;
using namespace std;
bool qw = false;
void open() {
	for (int i = 1; i <= 10; i++) cout << endl;
	for (int i = 1; i <= 20; i++) cout << " ";

	cout << "正在开机";
}
void desktop() {
	cout << "______________________________________________________________________________________" << endl;
}
vector<string> ListFilesInDirectory(const string& directoryPath) {
	vector<string> files;
	WIN32_FIND_DATA findData;
	HANDLE hFind = FindFirstFile((directoryPath + "\\*").c_str(), &findData);
	if (hFind != INVALID_HANDLE_VALUE) {
		do {
			// 排除目录,只添加文件
			if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
				files.push_back(findData.cFileName);
			}
		} while (FindNextFile(hFind, &findData) != 0);
		FindClose(hFind);
	} else {
		cerr << "Error finding files in directory." << endl;
	}
	return files;
}
bool check1 = false;
int p5 = 1;
int slyx() {
	for (;;) {
		cout << "你想玩第几关?(最多是5关)" << endl;
		string filename;
		cin >> p5;
		filename = to_string (p5);
		const char* c_filename = filename.c_str();
		char a1[100 + 10][100 + 10] = {};
		int s1[100 + 10][100 + 10] = {};
		int sum1 = 0, ans1 = 0;
		cerr << "输入为先列数后行数" << endl;
		cerr << "列数为从左往右数,行数为从上往下数" << endl;
		freopen(c_filename, "r", stdin);
		int n;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				cin >> a1[i][j];
			}
		}
		//fclose(stdin);
		freopen("CON", "r", stdin);
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (a1[i][j] == '#')
					s1[i][j] = 1;
			}
		}
		cerr << "0 ";
		for (int i = 1; i <= n; i++)
			cerr << i << " ";
		cerr << endl;
		for (int i = 1; i <= n; i++) {
			cerr << i << " ";
			for (int j = 1; j <= n; j++)
				cerr << "? ";
			cerr << endl;
		}
		for (int i = 1;; i++) {
			int u, p;
			cin >> p >> u;
			if (a1[u][p] == '*') {
				check1 = true;
				cerr << "Game over" << endl;
				break;
				return 0;
			} else {
				if (a1[u][p + 1] == '*')sum1++;
				if (a1[u][p - 1] == '*')sum1++;
				if (a1[u + 1][p] == '*')sum1++;
				if (a1[u - 1][p] == '*')sum1++;
				if (a1[u + 1][p + 1] == '*')sum1++;
				if (a1[u - 1][p + 1] == '*')sum1++;
				if (a1[u + 1][p - 1] == '*')sum1++;
				if (a1[u - 1][p - 1] == '*')sum1++;
				s1[u][p] = 0;
			}
			cerr << "第" << p << "列" << " " << "第" << u << "行附近" << "有" << sum1 << "枚地雷" << endl;
			sum1 = 0;
			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= n; j++)
					if (s1[i][j] == 0)
						ans1++;
			}
			cerr << ans1 << endl;
			if (ans1 == n * n) {
				cout << "You Win!" << endl;
				break;
				return 0;
			}
			ans1 = 0;
		}
		cout << "是否继续玩(玩输入yes,否则输入no)" << endl;
		string qw;
		cin >> qw;
		if (qw == "yes") {
			continue;
		} else if (qw == "no") {
			break;
		}
	}
}
bool c1 = false;
string hj[100 + 10];
int ui = 0;
int main() {
	for (int i = 1; i <= 10; i++) {
		open();
		for (int j = 1; j <= 3; j++) {
			cout << ".";
		}
		system("cls");
	}
	desktop();
	freopen("缓存.txt", "a", stdout);
	cout << "1" << endl;
	freopen("CON", "a", stdout);
	cout << "360正在全面查杀中" << endl;
	string directoryPath = "."; // 当前目录
	auto files = ListFilesInDirectory(directoryPath);
	for (const auto& file : files) {
		if (file == "彩虹猫.exe") {
			c1 = true;
			hj[ui++] = file;
		} else if (file == "熊猫烧香.exe") {
			c1 = true;
			hj[ui++] = file;
		} else if (file == "Windows XP.exe") {
			c1 = true;
			hj[ui++] = file;
		}
	}

	if (c1 == true) {
		cout << "!!!检测到" << ui << "个病毒" << endl;
		cout << "病毒名:" << endl;
		for (int jk = 0; jk < ui; jk++) {
			cout << hj[jk] << endl;
		}
		for (long long a = -9999999999; a <= 999999999; a++) {
			;
		}
		cout << "正在为你清理" << endl;
		for (int jk = 0; jk < ui; jk++) {
			fs::path filename = hj[jk];
			// 尝试删除文件
			if (fs::remove(filename)) {
				cout << "文件删除成功。" << endl;
			} else {
				cout << "文件删除失败。" << endl;
			}
		}
	}
	cout << "请通过终端命令" << endl;
	for (;;) {
		string a;
		cin >> a;
		if (a == "new-build.txt") {
			cout << "请输入内容" << endl;
			for (;;) {
				freopen("0.txt", "a", stdout);
				string b;
				cin >> b;
				if (b == "ctrl+shut") {
					fclose(stdout);
					freopen("CON", "a", stdout);
					cout << "是否保存文件" << endl;
					string e;
					cin >> e;
					if (e == "yes") {
						cout << "请重命名文件" << endl;
						// 旧文件名
						string oldName = "0.txt";
						// 新文件名
						string newName ;
						cin >> newName;
						// 使用rename函数更改文件名
						if (rename(oldName.c_str(), newName.c_str()) != 0) {
							cerr << "文件重命名失败" << endl;
						}
						cout << "文件重命名成功" << endl;
						break;
					} else if (e == "no") {
						fs::path filename = "0.txt";

						// 尝试删除文件
						if (fs::remove(filename)) {
							cout << "文件删除成功。" << endl;
						} else {
							cout << "文件删除失败。" << endl;
						}
					}
				} else {
					cout << b;
				}
			}
		} else if (a == "new-build.doc") {
			cout << "请输入内容" << endl;
			for (;;) {
				freopen("0.dco", "a", stdout);
				string b;
				cin >> b;
				if (b == "ctrl+shut") {
					fclose(stdout);
					freopen("CON", "a", stdout);
					cout << "是否保存文件" << endl;
					string e;
					cin >> e;
					if (e == "yes") {
						cout << "请重命名文件" << endl;
						// 旧文件名
						string oldName = "0.dco";
						// 新文件名
						string newName ;
						cin >> newName;
						// 使用rename函数更改文件名
						if (rename(oldName.c_str(), newName.c_str()) != 0) {
							cerr << "文件重命名失败" << endl;
						}
						cout << "文件重命名成功" << endl;
						break;
					} else if (e == "no") {
						fs::path filename = "0.txt";

						// 尝试删除文件
						if (fs::remove(filename)) {
							cout << "文件删除成功。" << endl;
						} else {
							cout << "文件删除失败。" << endl;
						}
					}
				} else {
					cout << b;
				}
			}
		} else if (a == "new-build.rtf") {
			cout << "请输入内容" << endl;
			for (;;) {
				freopen("0.rtf", "a", stdout);
				string b;
				cin >> b;
				if (b == "ctrl+shut") {
					fclose(stdout);
					freopen("CON", "a", stdout);
					cout << "是否保存文件" << endl;
					string e;
					cin >> e;
					if (e == "yes") {
						cout << "请重命名文件" << endl;
						// 旧文件名
						string oldName = "0.rtf";
						// 新文件名
						string newName ;
						cin >> newName;
						// 使用rename函数更改文件名
						if (rename(oldName.c_str(), newName.c_str()) != 0) {
							cerr << "文件重命名失败" << endl;
						}
						cout << "文件重命名成功" << endl;
						break;
					} else if (e == "no") {
						fs::path filename = "0.txt";

						// 尝试删除文件
						if (fs::remove(filename)) {
							cout << "文件删除成功。" << endl;
						} else {
							cout << "文件删除失败。" << endl;
						}
					}
				} else {
					cout << b;
				}
			}
		} else if (a == "read") {

			std::string filename;
			std::cout << "请输入文件名: ";
			std::cin >> filename; // 获取用户输入的文件名
			// 使用ifstream打开文件
			std::ifstream file(filename);
			if (!file.is_open()) {
				std::cerr << "无法打开文件: " << filename << std::endl;
				return 1; // 如果文件无法打开,则退出程序
			}

			std::string line;
			// 读取文件内容,直到文件结束
			while (std::getline(file, line)) {
				std::cout << line << std::endl; // 输出每一行内容
			}
			file.close(); // 关闭文件
			for (int i = 1; i <= 3; i++) cout << endl;
			cout << "是否关闭" << endl;
			string q;
			cin >> q;
			for (;;) {
				if (q == "yes") {
					break;
				}
				if (q == "no") {
					cout << "你继续看" << endl;
				}
			}
		}
		if (a == "renovate") {
			cout << "---------------------------------------------------------以下为新消息---------------------------------------------------" << endl;
			string directoryPath = "."; // 当前目录
			auto files = ListFilesInDirectory(directoryPath);
			for (const auto& file : files) {
				cout << file << endl;
			}
		} else if (a == "shut") {
			freopen("缓存.txt", "a+", stdout);
			for (int a = 1; a < 10000000; a++) cout << "gnrbghytbnhvbgjundrrtgtgt " << a << "rfmngurbnefdgujntbnbvn jtb gr b hn ynj ht gb " << endl;
			freopen("CON", "a+", stdout);
			cerr << "已关机" << endl;
			return 0;
		} else if (a == "360") {
			cout << "输入指令" << endl;
			cout << "输入1,扫描病毒" << endl;
			cout << "输入2,清理垃圾" << endl;
			int y;
			cin >> y;
			if (y == 1) {
				for (int i = 1; i < 100000000; i++) {
					;
				}
				cout << "扫描完成 您的电脑很健康" << endl;
				freopen("缓存.txt", "a+", stdout);
				cout << "已查杀并清除" << endl;
			} else if (y == 2) {
				cout << "扫描完成:" << endl;
				cout << "缓存文件    清理选项:yes" << endl;
				cout << "你想要清除吗?" << endl;
				cout << "想清理输入1,不想输入2" << endl;
				int u;
				cin >> u;
				if (u == 1) {
					fs::path filename = "缓存.txt";
					// 尝试删除文件
					if (fs::remove(filename)) {
						cout << "文件删除成功。" << endl;
					} else {
						cout << "文件删除失败。" << endl;
					}
					freopen("缓存.txt", "a+", stdout);
					cout << "扫描到大量缓存,已清除" << endl;
					freopen("CON", "a+", stdout);
				} else continue;
			}
		} else if (a == "game") {
			cout << "-------------------------------------------------------以下为游戏选择界面------------------------------------------------------" << endl;
			cout << "扫雷游戏" << endl;
			cout << "规则怪谈LV1.(还未开发)" << endl;
			cout << "躺平发育(还未开发)" << endl;
			cout << "选择游戏:输入名字" << endl;
			string p;
			cin >> p;
			if (p == "扫雷游戏") {
				slyx();
			} else if (p == "规则怪谈LV1." || p == "躺平发育") {
				continue;
			} else {
				cout << "请重新输入游戏名,再次输错,请重新在终端输入game";
				string we;
				cin >> we;
				if (we == "扫雷游戏") {
					slyx();
				} else if (we == "规则怪谈LV1." || we == "躺平发育") {
					continue;
				}
			}
		} else if (a == "calculator") {
			for (;;) {
				cout << "请先输入符号,再根据提示输入" << endl;
				string a, b, c;
				cin >> b;
				if (b != "over") {

					if (b == "+") {
						cout << "输入两个数" << endl;
						cin >> a >> c;
						int a1 = stoi(a);
						int c1 = stoi(c);
						cout << a1 + c1 << endl;
					} else if (b == "-") {
						cout << "输入两个数" << endl;
						cin >> a >> c;
						int a1 = stoi(a);
						int c1 = stoi(c);
						cout << a1 - c1 << endl;
					} else if (b == "*") {
						cout << "输入两个数" << endl;
						cin >> a >> c;
						int a1 = stoi(a);
						int c1 = stoi(c);
						cout << a1*c1 << endl;
					} else if (b == "/") {
						cout << "输入两个数" << endl;
						cin >> a >> c;
						int a1 = stoi(a);
						int c1 = stoi(c);
						if (c1 == 0) {
							cout << "Error:0不可以作为除数" << endl;
							cout << "请重新输入" << endl;
							cin >> a >> c;
							int a1 = stoi(a);
							int c1 = stoi(c);
							if (c1 == 0) {
								continue;
							} else {
								cout << double(a1 / c1) << endl;
							}
						} else {
							cout << double(a1 / c1) << endl;
						}
					} else if (b == "sqrt") {
						cout << "输入一个数" << endl;
						cin >> a;
						int a1 = stoi(a);
						cout << double(sqrt(a1)) << endl;
					} else if (b == "^") {
						cout << "先输入底数,再输入指数" << endl;
						cout << "输入两个数" << endl;
						cin >> a >> c;
						int a1 = stoi(a);
						int c1 = stoi(c);
						cout << double(pow(a1, c1)) << endl;
					}
				} else break;
			}
		}
	}
}
原文