Update and delete

This commit is contained in:
Dengrb 2024-10-04 20:35:52 +08:00
parent 42a4b25c15
commit 2cec26b35d
7 changed files with 28 additions and 160 deletions

View File

@ -1,18 +0,0 @@
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "D:/TDM-GCC/bin/gcc.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

24
.vscode/launch.json vendored
View File

@ -1,24 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "c:/Users/Admin/gitee/code",
"program": "c:/Users/Admin/gitee/code/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

62
.vscode/settings.json vendored
View File

@ -1,63 +1,3 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false,
"files.associations": {
"iosfwd": "cpp",
"ostream": "cpp"
}
"C_Cpp.errorSquiggles": "disabled"
}

2
.vscode/tasks.json vendored
View File

@ -3,7 +3,7 @@
{
"type": "cppbuild",
"label": "C/C++: g++.exe 生成活动文件",
"command": "D:\\TDM-GCC\\bin\\g++.exe",
"command": "F:\\TDM-gcc\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",

View File

@ -2,7 +2,7 @@
#include <string>
#include <windows.h>
#include <cstdlib>
#include <fstream> // 用于文件存在性检查
#include <fstream>
#include "SimpleIni.h"
using namespace std;
@ -10,6 +10,7 @@ using namespace std;
// 函数声明
bool fileExists(const std::string& filename);
bool createDefaultConfig(const std::string& filename);
bool renameFolder(const std::string& oldName, const std::string& newName); // 使用 MoveFile
int main() {
const std::string configFile = "config.ini";
@ -39,7 +40,7 @@ int main() {
const char* name = ini.GetValue("User", "name", "0");
cout << "欢迎使用CSSO与CS起源切换程序" << endl;
cout << "当前模式: " <<name<<endl;
cout << "当前模式: " << name <<"(0为CSSO1为CS起源)"<< endl;
cout << "请选择操作:" << endl;
cout << "1. CSSO" << endl;
cout << "2. CS起源" << endl;
@ -53,10 +54,10 @@ int main() {
cout << "你已是CSSO模式!" << endl;
} else {
// 切换到CSSO模式
int result1 = system("ren bin bin_backup");
int result2 = system("ren bin2 bin");
bool result1 = renameFolder("bin", "bin_backup");
bool result2 = renameFolder("bin2", "bin");
if (result1 == 0 && result2 == 0) {
if (result1 && result2) {
ini.SetValue("User", "name", "0");
SI_Error saveRc = ini.SaveFile(configFile.c_str());
if (saveRc >= 0) {
@ -65,9 +66,9 @@ int main() {
cout << "保存配置文件失败!" << endl;
}
} else {
cout << "切换失败!" << endl;
cout << "切换失败!检查文件路径或权限。" << endl;
}
Sleep(100);
Sleep(1500);
}
}
else if (choice == 2) {
@ -75,10 +76,10 @@ int main() {
cout << "你已是CS起源模式!" << endl;
} else {
// 切换到CS起源模式
int result1 = system("ren bin bin2");
int result2 = system("ren bin_backup bin");
bool result1 = renameFolder("bin", "bin2");
bool result2 = renameFolder("bin_backup", "bin");
if (result1 == 0 && result2 == 0) {
if (result1 && result2) {
ini.SetValue("User", "name", "1");
SI_Error saveRc = ini.SaveFile(configFile.c_str());
if (saveRc >= 0) {
@ -87,9 +88,9 @@ int main() {
cout << "保存配置文件失败!" << endl;
}
} else {
cout << "切换失败!" << endl;
cout << "切换失败!检查文件路径或权限。" << endl;
}
Sleep(100);
Sleep(1500);
}
}
else if (choice == 3) {
@ -123,3 +124,15 @@ bool createDefaultConfig(const std::string& filename) {
SI_Error rc = ini.SaveFile(filename.c_str());
return (rc >= 0);
}
// 使用 MoveFile 重命名文件夹
bool renameFolder(const std::string& oldName, const std::string& newName) {
if (MoveFile(oldName.c_str(), newName.c_str())) {
cout << "重命名成功: " << oldName << " -> " << newName << endl;
return true;
} else {
DWORD error = GetLastError();
cout << "重命名失败: " << oldName << " -> " << newName << " (错误代码: " << error << ")" << endl;
return false;
}
}

Binary file not shown.

43
l.cpp
View File

@ -1,43 +0,0 @@
#include<iostream>
using namespace std;
int qian();
int shi11();
int main(){
cout <<"现在是百数计算"<<endl;
int number,ge,shi,bai;
cin >>number;
ge = number%10;
shi = number/10%10;
bai = number / 100;
number = ge*100 + shi*10 + bai;
cout << number<<endl;
shi11();
return 0;
}
int shi11(){
cout <<"现在是十数计算"<<endl;
int number,ge,shi;
cin >>number;
ge = number%10;
shi = number /10 ;
number = ge*10 + shi;
cout <<number<<endl;
qian();
return 0;
}
int qian(){
cout <<"现在是千数计算"<<endl;
int number1,ge1,shi1,bai1,qian1;
cin >>number1;
ge1 = number1 % 10;
shi1 = number1 / 10 % 10;
bai1 = number1 / 100 % 10;
qian1 = number1 /1000;
number1 = ge1*1000 + shi1*100 + bai1 *10 + qian1;
cout <<number1;
return 0;
}