Compare commits

..

61 Commits
java ... CPP

Author SHA1 Message Date
054eeb577a 删除.h文件,上传新程序 2025-03-01 10:02:55 +08:00
38b24072f0 update 2025-03-01 09:39:21 +08:00
3a354e7234 数字矩形更新 2025-03-01 09:06:20 +08:00
71fbb44d45 删除加更新 2025-03-01 09:03:04 +08:00
7dbdfd5b1c homework_2025.1.11 2025-01-11 08:16:30 +08:00
24799b5632 homework 12.27 2024-12-27 23:05:21 +08:00
d5b27fce64 update 12.21 2024-12-21 10:09:35 +08:00
c8b185a7aa homework 12.21 2024-12-20 22:08:14 +08:00
a3c1575649 update 2024-12-20 21:46:32 +08:00
a1ea243478 class update 12.14 2024-12-14 10:00:17 +08:00
c6ae7c7889 Merge branch 'CPP' of https://gitee.com/dengrb1/code into CPP 2024-12-14 09:26:31 +08:00
fbf9ee7dab class 奇偶求和 2024-12-14 09:18:40 +08:00
c32df704e2 Merge branch 'CPP' of https://gitee.com/dengrb1/code into CPP 2024-12-14 09:02:42 +08:00
45d121e943 homework 修改 2024-12-14 08:43:34 +08:00
5af1eb3a4e homework 12.14 2024-12-13 21:59:52 +08:00
6d0e343276 today laster 2024-12-07 09:59:03 +08:00
9a87ba69d6 加入了文件的名字 2024-12-07 09:00:11 +08:00
07320d68ef homework in 12.6 2024-12-06 22:52:31 +08:00
381be4fba1 update 12.6 2024-12-06 22:04:11 +08:00
a454d8c40a update homework 2024-11-30 10:01:11 +08:00
e39f0a2cb6 update in class
含有3的数字
2024-11-30 10:00:26 +08:00
75fd384742 update in class 2024-11-30 09:44:38 +08:00
f550c63324 update in class 2024-11-30 08:40:06 +08:00
0ef461bff3 update 2024-11-30 07:52:27 +08:00
867bdc0109 update in class 2024-11-23 08:50:34 +08:00
4dc7afa499 0 2024-11-22 22:58:35 +08:00
d2b0ed7908 update 2024/11/15 2024-11-15 22:53:19 +08:00
d3483cf241 update 2024-11-08 22:19:37 +08:00
aa0aa62691 update 2024-11-08 22:19:11 +08:00
46f428497b update 2024-11-02 07:39:41 +08:00
778ee62a92 update 2024-10-26 09:32:43 +08:00
d933df17a1 update 2024-10-26 09:15:45 +08:00
277b1758cb update 2024-10-08 23:05:59 +08:00
07f1f26aae update 2024-10-08 22:57:10 +08:00
7c91434745 update 亿位 laster 2024-10-07 16:21:41 +08:00
68a55e9aaa update 亿位 2024-10-07 16:17:48 +08:00
0d0781200f update 亿位 2024-10-07 16:14:04 +08:00
fd73f1c067 update 十万位 2024-10-07 09:45:51 +08:00
98ed1e7b68 update 2024-10-06 22:41:51 +08:00
68f8d90a51 homework_laster update 2024-10-06 22:41:36 +08:00
176658867d laster 2024-10-05 17:41:02 +08:00
1aa72c6ea3 update 2024-10-05 17:32:34 +08:00
0bb0f93abf update 2024/10/5 laster 2024-10-05 17:24:32 +08:00
405fc0974b update 2024/10/5 laster 2024-10-05 17:23:43 +08:00
50887fe4f0 update 2024/10/5 2024-10-05 17:14:49 +08:00
8e79158b9d update 2024/10/5 2024-10-05 14:00:07 +08:00
3aa787feb8 update 2024/10/5 2024-10-05 13:52:15 +08:00
2cec26b35d Update and delete 2024-10-04 20:35:52 +08:00
42a4b25c15
update
Signed-off-by: dengrb1 <drb12311@163.com>
2024-10-04 11:14:34 +00:00
89e5468588
update
Signed-off-by: dengrb1 <drb12311@163.com>
2024-10-04 10:46:20 +00:00
f01c18d958 update laster 2024-10-04 17:38:59 +08:00
330eb2c45a update 2024-10-04 17:38:10 +08:00
586c1e12d7 update laster 2024-10-04 17:33:39 +08:00
3444a4ab4f update 2024/10/4 2024-10-04 17:27:26 +08:00
e62d624f68 update 2024-10-04 16:42:46 +08:00
bbf0b48ef0 update 2024-10-04 16:26:37 +08:00
913b75f8bc update 2024-10-04 16:03:58 +08:00
0420ff9f94 update 2024/10/3 2024-10-03 14:52:13 +08:00
2684d8e9df update 2024/10/3 2024-10-03 10:01:27 +08:00
fb3ec35fdf update 2024/10/3 2024-10-03 09:09:23 +08:00
93339f0559 update 2024/10/2 2024-10-03 07:21:56 +08:00
23 changed files with 4528 additions and 4 deletions

18
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"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 Normal file
View File

@ -0,0 +1,24 @@
{
"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 Normal file
View File

@ -0,0 +1,59 @@
{
"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 Normal file
View File

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

77
3.14.cpp Normal file
View File

@ -0,0 +1,77 @@
#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,4 +1,3 @@
### Java 分支
编写关于 **Minecraft**_mods__plugins_
_此仓库为私人仓库_
**上课专用**

3630
SimpleIni.h Normal file

File diff suppressed because it is too large Load Diff

138
change.cpp Normal file
View File

@ -0,0 +1,138 @@
#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;
}
}

13
class/AB.cpp Normal file
View File

@ -0,0 +1,13 @@
#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;
}

33
class/calc.cpp Normal file
View File

@ -0,0 +1,33 @@
#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;
}

21
class/class.cpp Normal file
View File

@ -0,0 +1,21 @@
//未知
#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;
}

109
class/class_test.cpp Normal file
View File

@ -0,0 +1,109 @@
#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;
}

17
class/dao_ji_shi.cpp Normal file
View File

@ -0,0 +1,17 @@
//倒计时
#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;
}

87
class/hui_wen_shu.cpp Normal file
View File

@ -0,0 +1,87 @@
//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;
}
}
}

21
class/ji_shu_qiu_he.cpp Normal file
View File

@ -0,0 +1,21 @@
//奇偶求和
#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;
}

21
class/max_and_min.cpp Normal file
View File

@ -0,0 +1,21 @@
#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;
}

19
class/shu_zi_jv_xin.cpp Normal file
View File

@ -0,0 +1,19 @@
//数字矩形
#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;
}

13
class/test.cpp Normal file
View File

@ -0,0 +1,13 @@
#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;
}

12
class/test1.cpp Normal file
View File

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

40
sha_lou.cpp Normal file
View File

@ -0,0 +1,40 @@
//沙漏
#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;
}

96
system.cpp Normal file
View File

@ -0,0 +1,96 @@
#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;
}

27
zheng_san_jiao_xin.cpp Normal file
View File

@ -0,0 +1,27 @@
//正三角形
#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;
}

22
zhi_jiao_san_jiao_cin.cpp Normal file
View File

@ -0,0 +1,22 @@
//直角三角形
#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;
}