Compare commits

..

2 Commits
CPP ... master

Author SHA1 Message Date
3a237a37aa 更新 README.md 2025-02-28 21:52:04 +08:00
541d50655c ? 2025-02-03 11:23:49 +08:00
31 changed files with 248 additions and 4528 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
}
]
}
]
}

59
.vscode/settings.json vendored
View File

@ -1,59 +0,0 @@
{
"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
}

28
.vscode/tasks.json vendored
View File

@ -1,28 +0,0 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe 生成活动文件",
"command": "D:\\TDM-GCC\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}

View File

@ -1,77 +0,0 @@
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
float r,d,C,S;
string danwei = "cm";
int CIN;
cout <<"请输入选项(默认单位cm):"<<endl;
cout <<"1.面积"<<endl;
cout <<"2.周长"<<endl;
cout <<"3.改单位"<<endl;
cout <<">>>";
cin >> CIN;
if (CIN == 1)
{
cout <<"请输入半径(若是直径,请留空):";
cin >>r;
if (r==Unknown)
{
cout <<"请输入直径:";
cin >>d;
if (d==Unknown)
{
cout <<"无数据!";
Sleep(2000);
return 1;
}
r = d/2;
S = r*r*3.14;
cout <<"结果:"<<S<<danwei;
Sleep(2500);
return 0;
}else
{
S = r*r*3.14;
cout <<"结果是:"<<S<<danwei;
Sleep(2500);
return 0;
}
}else if (CIN == 2)
{
cout <<"请输入直径(若是半径,请留空):";
cin >>d;
if (d==Unknown)
{
cout <<"请输入半径:";
cin >>r;
if (r==Unknown)
{
cout <<"无数据!"<<endl;
Sleep(2000);
return 1;
}else
{
d = r*2;
C = 3.14*d;
cout <<"结果是:"<<C<<danwei;
Sleep(2500);
return 0;
}
}else
{
C = 3.14*d;
cout <<"结果是:"<<C<<danwei<<endl;
return 0;
}
}
}

View File

@ -1,3 +1 @@
_此仓库为私人仓库_
**上课专用**
**_本仓库为私人仓库_**

File diff suppressed because it is too large Load Diff

View File

@ -1,138 +0,0 @@
#include <iostream>
#include <string>
#include <windows.h>
#include <cstdlib>
#include <fstream>
#include "SimpleIni.h"
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";
// 检查 config.ini 是否存在
if (!fileExists(configFile)) {
cout << "未检测到 " << configFile << " 文件,正在创建默认配置..." << endl;
if (createDefaultConfig(configFile)) {
cout << "默认配置文件创建成功。" << endl;
} else {
cout << "创建默认配置文件失败。" << endl;
return 1; // 退出程序,因为无法创建配置文件
}
}
// 初始化INI文件
CSimpleIniA ini;
ini.SetUnicode();
ini.SetMultiKey(true);
SI_Error rc = ini.LoadFile(configFile.c_str());
if (rc < 0) {
cout << "无法加载配置文件 " << configFile << endl;
return 1;
}
const char* name = ini.GetValue("User", "name", "0");
cout << "欢迎使用CSSO与CS起源切换程序" << endl;
cout << "当前模式: " << name <<"(0为CSSO1为CS起源)"<< endl;
cout << "请选择操作:" << endl;
cout << "1. CSSO" << endl;
cout << "2. CS起源" << endl;
cout << "3. 退出" << endl;
int choice;
cin >> choice;
if (choice == 1) {
if (strcmp(name, "0") == 0) {
cout << "你已是CSSO模式!" << endl;
} else {
// 切换到CSSO模式
bool result1 = renameFolder("bin", "bin_backup");
bool result2 = renameFolder("bin2", "bin");
if (result1 && result2) {
ini.SetValue("User", "name", "0");
SI_Error saveRc = ini.SaveFile(configFile.c_str());
if (saveRc >= 0) {
cout << "成功切换到CSSO模式!" << endl;
} else {
cout << "保存配置文件失败!" << endl;
}
} else {
cout << "切换失败!检查文件路径或权限。" << endl;
}
Sleep(1500);
}
}
else if (choice == 2) {
if (strcmp(name, "1") == 0) {
cout << "你已是CS起源模式!" << endl;
} else {
// 切换到CS起源模式
bool result1 = renameFolder("bin", "bin2");
bool result2 = renameFolder("bin_backup", "bin");
if (result1 && result2) {
ini.SetValue("User", "name", "1");
SI_Error saveRc = ini.SaveFile(configFile.c_str());
if (saveRc >= 0) {
cout << "成功切换到CS起源模式!" << endl;
} else {
cout << "保存配置文件失败!" << endl;
}
} else {
cout << "切换失败!检查文件路径或权限。" << endl;
}
Sleep(1500);
}
}
else if (choice == 3) {
cout << "退出程序." << endl;
Sleep(100);
return 0;
}
else {
cout << "无效的选项,请重新运行程序并选择正确的选项。" << endl;
}
return 0;
}
// 检查文件是否存在
bool fileExists(const std::string& filename) {
std::ifstream infile(filename);
return infile.good();
}
// 创建默认的config.ini文件
bool createDefaultConfig(const std::string& filename) {
CSimpleIniA ini;
ini.SetUnicode();
ini.SetMultiKey(true);
// 设置默认值
ini.SetValue("User", "name", "0");
// 保存INI文件
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;
}
}

126
change/change.py Normal file
View File

@ -0,0 +1,126 @@
import ctypes
import winreg
import shutil
import sys
import os
from time import sleep
import shelve
# 检查并创建cmd文件的函数
def check_and_create_cmd_files(path):
csso_cmd_path = os.path.join(path, 'csso.cmd')
css_cmd_path = os.path.join(path, 'css.cmd')
if not os.path.isfile(csso_cmd_path):
with open(csso_cmd_path, 'w') as csso_file:
csso_file.write('@echo off\n')
csso_file.write('ren bin bin1\n')
csso_file.write('ren bin2 bin\n')
if not os.path.isfile(css_cmd_path):
with open(css_cmd_path, 'w') as css_file:
css_file.write('@echo off\n')
css_file.write('ren bin bin2\n')
css_file.write('ren bin1 bin\n')
def get_steam_path():
try:
# 从注册表读取 Steam 安装路径
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Valve\Steam") as key:
steam_path, _ = winreg.QueryValueEx(key, "SteamPath")
return steam_path
except FileNotFoundError:
print("未能找到 Steam 安装路径。")
return None
def delete_csso_folder(steam_path):
target_folder = os.path.join(steam_path, "steamapps", "sourcemods", "csso")
if os.path.exists(target_folder):
print(f"正在删除文件夹: {target_folder}")
shutil.rmtree(target_folder) # 递归删除文件夹及其内容
print("文件夹已删除。")
else:
print(f"文件夹不存在: {target_folder}")
with shelve.open('main') as db:
# 如果数据库中没有 'bin_name',返回 '1'(默认值)
bin_name = db.get('bin_name', '1')
if bin_name is None:
bin_name = '1' # 这里设为字符串以保持一致
db['bin_name'] = bin_name
def is_admin():
"""检查当前是否有管理员权限"""
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if is_admin():
# 如果已经是管理员,执行主要的逻辑
print("已获得管理员权限")
path = os.getcwd() # 获取当前工作目录的实际路径
# 检查并创建cmd文件
check_and_create_cmd_files(path)
print(f"当前模式(1为CS原版, 2为CS:SO): {bin_name}")
print("请选择模式")
print("1. 改为CS:SO\n2. 改回原版\n3. 删除CSSO并删除程序\n4. 退出")
choice = input('>>> ')
if choice == '1':
if bin_name == '2':
print('错误你已是CS:SO!')
sleep(1.5)
sys.exit()
# 启动 csso.cmd
os.startfile(os.path.join(path, 'csso.cmd'))
with shelve.open('main') as db:
db['bin_name'] = '2' # 切换至 CS:SO
print("完成!")
sleep(1.85)
sys.exit()
elif choice == '2':
if bin_name == '1':
print("错误,你已是原版!")
sleep(1.5)
sys.exit()
# 启动 css.cmd
os.startfile(os.path.join(path, 'css.cmd'))
with shelve.open('main') as db:
db['bin_name'] = '1' # 切换至 CS 原版
print("完成!")
sleep(1.55)
sys.exit()
elif choice == '3':
if input('确定吗?\n 1.确定 2.不确定\n>>>') == '1':
with open('del.cmd','w') as d:
d.write('@echo off\n')
d.write('timeout /t 2 /nobreak > nul\n')
d.write('del /Q csso.cmd css.cmd change.exe main.bak main.dat main.dir\n')
d.write('del "%~f0"')
if bin_name != '1':
os.startfile(path,'css.cmd')
steam_path = get_steam_path()
if steam_path:
delete_csso_folder(steam_path)
os.rmdir(f'{path}\\bin2')
os.startfile(os.path.join(path , 'del.cmd'))
else:
sys.exit()
elif choice == '4':
sys.exit()
else:
print("输入错误!")
else:
# 如果没有管理员权限,重新以管理员权限运行脚本
print("请求管理员权限...")
# 使用 `ctypes` 模块提升权限,重新运行脚本
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)

View File

@ -1,13 +0,0 @@
#include<iostream>
#include<cmath>
using namespace std;
int main(){
double x1,y1,x2,y2,result;
cin >>x1>>y1>>x2>>y2;
result = sqrt((x1-x2) * (x1-x2) + (y1-y2) * (y1-y2));
cout <<"结果:"<<int(result)<<endl;
}

View File

@ -1,33 +0,0 @@
#include<iostream>
#include<windows.h>
using namespace std;
/*
int main(){
int range = 0;
while (range != 5)
{
int a,s;
cin >>a;
s = a * a;
cout <<"结果:"<<s<<endl;
range++;
}
return 0;
}*/
int main(){
int time = 15;
while (time > 0)
{
cout <<"你还剩"<<time<<"分钟"<<endl;
Sleep(60000);
time--;
}
return 0;
}

View File

@ -1,21 +0,0 @@
//未知
#include<iostream>
using namespace std;
int main(){
long long cheng=1,num2,num1;
cout <<"请输入第一个数字:";
cin >>num1;
cout <<"请输第二个数字,每输一个数字,空一格,再输一个数字(Enter结束):";
for (int i = 1; i <= num1; i++)
{
cin >>num2;
cheng *=num2;
}
cout <<cheng<<endl;
return 0;
}

View File

@ -1,109 +0,0 @@
#include<iostream>
#include<windows.h>
#include <cstdlib>
#include <ctime>
using namespace std;
/*
int main(){
int a,b,c;
cin >>a>>b>>c;
if (a = 1)
{
cout <<"no";
Sleep(1000);
return 0;
}
if ((a+b) > c)
{
cout <<"yes";
Sleep(1000);
return 0;
}else if ((a+c) > b)
{
cout <<"yes";
Sleep(1000);
return 0;
}else if ((b+c) > a)
{
cout <<"yes";
Sleep(1000);
return 0;
}else
{
cout <<"no";
Sleep(1000);
return 1;
}
return 0;
}
int main(){ //三角形判断
int a,b,c;
cin >>a>>b>>c;
if ((a+b > c) && (a+c > b) && (b+c > a))
{
cout <<"yes";
}else
{
cout <<"no";
}
return 0;
}
int main() {
srand(static_cast<unsigned int>(time(nullptr))); // 初始化随机数种子
int random_number = rand() % 5 + 1; // 生成 1 到 5 之间的随机数
cout <<random_number<<endl;
int player_cin;
cout <<"输入你猜的数字,1-5之间"<<endl;
cin >> player_cin;
if (player_cin == random_number)
{
cout <<"恭喜您,中奖了!奖金10元!"<<endl;
return 0;
}else
{
cout <<"没中奖!请付费2元"<<endl;
cout <<"中奖号码是:"<<random_number<<endl;
return 1;
}
return 0;
}
int main(){
int n = 6;
//cin >> n;
int sum = n * (n+1) /2;
cout <<sum;
return 0;
}*/
int main(){
int count = 0;
for (int i = 1; i < 1000; ++i)
{
if (to_string(i).find('3') != string::npos)
{
count++;
}
}
cout <<count<<endl;
return 0;
}

View File

@ -1,17 +0,0 @@
//倒计时
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
for (int i = 15; i > 0; i--)
{
cout <<"距离考试结束还剩:"<<i<<"分钟"<<endl;
Sleep(60000);
}
cout <<"考试结束!"<<endl;
return 0;
}

19
class/e_de_jin_se_zhi.cpp Normal file
View File

@ -0,0 +1,19 @@
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
double e = 1.0;
double factorial = 1.0;
for (int i = 1; i <= 20; i++)
{
factorial *= i;
e += 1.0 / factorial;
}
cout << fixed << setprecision(3) << e << endl;
return 0;
}

View File

@ -0,0 +1,29 @@
//分子序列求和
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int n;
double a=2,b=1,c,d;
cin >>n;
if (n > 100)
{
cout <<"输入的数字太大了!"<<endl;
return 1;
}
double sum=0;
for (int i = 1; i <= n; i++)
{
sum += a/b;
c = a;
d = b;
a = a+d;
b = c;
}
cout <<fixed<<setprecision(2)<<sum<<endl;
return 0;
}

View File

@ -1,87 +0,0 @@
//do...while
//计算各个数位之和
#include<iostream>
using namespace std;
void while_1();
void do_while();
void huiwenshu();
int main(){
int choose;
cout <<"选择"<<endl;
cout <<"1.do...while"<<endl;
cout <<"2.while"<<endl;
cout <<"3.回文数"<<endl;
cin >>choose;
if (choose == 2)
{
while_1();
}else if (choose == 1)
{
do_while();
}else if (choose == 3)
{
huiwenshu();
}else{
cout <<"输入错误!"<<endl;
}
}
void do_while(){
cout <<"已进入do..while"<<endl;
int CIN,andy;
int a,b,c;
do
{
cin >>CIN;
a = CIN / 100;
b= CIN / 10 % 10;
c = CIN % 10;
andy = a+b+c;
cout <<andy<<endl;
} while (CIN > 0);
}
void while_1(){
cout <<"已进入while"<<endl;
int CIN2,andy,a,b,c;
while (CIN2 > 0)
{
cin >>CIN2;
a = CIN2 / 100;
b = CIN2 / 10 % 10;
b = CIN2 % 10;
andy = a+b+c;
cout <<andy<<endl;
}
}
void huiwenshu(){
while (true)
{
int n,ge,number = 0,number2;
cin >>n;
number2 = n;
do
{
ge = n%10;
number = number * 10 + ge;
n = n / 10;
} while (n > 0);
if (number != number2)
{
cout <<"NO!"<<endl;
}else
{
cout <<"YES!"<<endl;
}
}
}

View File

@ -1,21 +0,0 @@
//奇偶求和
#include<iostream>
using namespace std;
int main(){
int n,sum1=0,sum2=0;
cin >>n;
for (int i = 1; i<=n; i+=2)
{
sum1+=i;
}
for (int i = 2; i <= n; i+=2)
{
sum2+=i;
}
cout <<sum1<<" "<<sum2<<endl;
return 0;
}

View File

@ -1,21 +0,0 @@
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n; // 输入整数的个数
int num, min_val;
cin >> num; // 先输入第一个数字,初始化最小值
min_val = num; // 将第一个数字设为初始的最小值
for (int i = 1; i < n; ++i) {
cin >> num; // 输入其余的数字
min_val = min(min_val, num); // 更新最小值
}
cout << min_val << endl; // 输出最小值
return 0;
}

View File

@ -1,19 +0,0 @@
//数字矩形
#include<iostream>
using namespace std;
int main(){
int n;
cin >>n;
for (int i = n-1; i < n; i++)
{
for (int i = 1; i <= n; i++)
{
cout <<"456"<<endl;
}
}
return 0;
}

View File

@ -1,13 +0,0 @@
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int a,b,c;
a = 3;
b = 4;
c = a * a + b * b;
cout <<a<<"*"<<a<<"+"<<b<<"*"<<b<<"="<<setprecision(2)<<c<<endl;
return 0;
}

View File

@ -1,12 +0,0 @@
#include<iostream>
using namespace std;
int main(){
float jg = 4/8 * 100 /2.0;
cout <<"结果:"<<jg;
return 0;
}

View File

@ -0,0 +1,25 @@
#include <iostream>
using namespace std;
int main(){
int n,m,x;
cout << "请输入两个数:";
cin >> n >> m;
if (m>n)
{
x = n;
}else
{
x = m;
}
while ( n%x!=0 || m%x!=0)
{
x--;
}
cout << "最大公约数为:" << x << endl;
return 0;
}

BIN
dist/change.exe vendored Normal file

Binary file not shown.

13
old_homework/3721.cpp Normal file
View File

@ -0,0 +1,13 @@
#include <iostream>
using namespace std;
int main() {
// 遍历1到200的所有数
for (int i = 1; i <= 200; i++) {
// 判断该数是否满足"3721"数的条件
if (i % 3 == 2 && i % 7 == 1) {
cout << i << " "; // 输出满足条件的数
}
}
return 0;
}

10
pyinstaller_sys.py Normal file
View File

@ -0,0 +1,10 @@
import sys
import os
def get_path(relative_path):
try:
base_path = sys._MEIPASS # pyinstaller打包后的路径
except AttributeError:
base_path = os.path.abspath(".") # 当前工作目录的路径
return os.path.normpath(os.path.join(base_path, relative_path)) # 返回实际路径

View File

@ -1,40 +0,0 @@
//沙漏
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >>n;
int mid = (n - 1) / 2;
for (int i = 0; i < n; i++)
{
int a,b;
if (i <= mid)
{
a = i;
b = n - 2 *i;
}else
{
int j = 2 * mid - i;
a = j;
b = n -2 *j;
}
for (int j = 0; j < a; j++)
{
cout <<" ";
}
for (int y = 0; y < b; y++)
{
cout <<"*";
}
cout <<endl;
}
return 0;
}

View File

@ -1,96 +0,0 @@
#include <windows.h>
#include <shellapi.h>
#include <sddl.h>
#include <tchar.h>
#include <iostream>
#include<string>
using namespace std;
bool IsRunAsAdmin() {
BOOL isAdmin = FALSE;
PSID adminGroup = NULL;
// SID for Administrators group
SID_IDENTIFIER_AUTHORITY ntAuthority = SECURITY_NT_AUTHORITY;
if (AllocateAndInitializeSid(&ntAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &adminGroup)) {
if (!CheckTokenMembership(NULL, adminGroup, &isAdmin)) {
isAdmin = FALSE;
}
FreeSid(adminGroup);
}
return isAdmin == TRUE;
}
void RunAsAdmin() {
TCHAR szPath[MAX_PATH];
if (!GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath))) {
cerr << "Failed to get module file name." << endl;
return;
}
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.lpVerb = TEXT("runas");
sei.lpFile = szPath;
sei.hwnd = NULL;
sei.nShow = SW_NORMAL;
if (!ShellExecuteEx(&sei)) {
DWORD dwError = GetLastError();
if (dwError == ERROR_CANCELLED) {
cerr << "The user refused to allow elevation." << endl;
} else {
cerr << "ShellExecuteEx failed with error code " << dwError << endl;
}
}
}
int _tmain() {
if (!IsRunAsAdmin()) {
cout << "Program is not running with administrator privileges. Attempting to restart as administrator..." << endl;
RunAsAdmin();
return 0; // Exit the current instance
}
// Your code that requires admin privileges goes here
cout << "Program is running with administrator privileges." << endl;
// Example of code that requires admin privileges
// You can add any code here that needs admin rights
// 例如:修改系统设置、访问受限文件等
extern string choose;
string choose = "";
cout <<"C++ command v1.0"<<endl;
cout <<"https://github.com/dengrb1/"<<endl;
while (choose!="exit")
{
cin >>choose;
if (choose=="list")
{
system("dir");
}else if (choose=="help")
{
cout <<"------------------------------------"<<endl;
cout <<"C++ command帮助菜单"<<endl;
cout <<"注意!本程序区分大小写!"<<endl;
cout <<"list--当前运行环境目录"<<endl;
cout <<"help--帮助菜单"<<endl;
cout <<"cd--加载文件夹"<<endl;
cout <<"------------------------------------"<<endl;
choose = Unknown;
}else{
cout <<choose<<"没有这个指令!"<<endl;
choose = Unknown;
}
}
// Prevent closing immediately to observe behavior
return 0;
}

25
test.cpp Normal file
View File

@ -0,0 +1,25 @@
#include <iostream>
using namespace std;
// 函数:计算最大公约数
int gcd(int a, int b) {
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
// 函数:计算最小公倍数
int lcm(int a, int b) {
return (a / gcd(a, b)) * b;
}
int main() {
int M, N;
cin >> M >> N;
cout << lcm(M, N) << endl;
return 0;
}

View File

@ -1,27 +0,0 @@
//正三角形
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
int n;
cin >>n;
for (int i = 1; i <= n; i++)
{
for (int y = 1; y <= n-i; ++y)
{
cout <<" ";
}
for (int j = 1; j <= 2*i-1; ++j)
{
cout <<"*";
}
cout <<endl;
}
//Sleep(1000000000);
return 0;
}

View File

@ -1,22 +0,0 @@
//直角三角形
#include<iostream>
#include<string>
using namespace std;
int main(){
int n;
cin >>n;
string xin = "*";
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; ++j)
{
cout <<xin;
}
cout <<endl;
}
return 0;
}