冒泡排序
简介分享代码,记录学习过程
代码123456789101112131415161718192021222324#include <bits/stdc++.h>#define SIZE(arr) int(sizeof(arr) / sizeof(arr[0]))using namespace std;int main() { int a[] = {3, 5, 6, 4, 6, 3, 8}; int t; for (int i = 0; i < SIZE(a); i++) { for (int j = 0; j < SIZE(a) - 1; j++) { if (a[j] > a[j + 1]) { t = a[j]; a[j] = a[j + 1]; a[j + 1] = t; } } } for (int i = 0; i < SIZE(a); i++) { cout << a[i] << &qu ...
四舍五入
简介分享代码,记录学习过程
代码12345678910#include <bits/stdc++.h>using namespace std;int main() { double d; d = 0.325; // 其中的数字就是保留的位数 cout << fixed << setprecision(2) << d; return 0;}
字符数组与字符串
简介分享代码,记录学习过程
代码123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960#include <bits/stdc++.h>using namespace std;int main() { // 字符数组 /* strlen(s1);求字符串长度 strcmp(s1, s2);字符串比较:按照字典排序比较大小 若s1的字典码大于s2返回正数反之返回负数,相等返回零 strncmp(s1, s2, n);把 s1,s2 的前 n 个进行比较 strcat(s1, s2);将 s2 连接到 s1 的后面 s1要有足够的空间存放 strncat(s1, s2, n);将 s2 的前 n 个字符连接到 s1 的后面 strcpy(s1, s2);将 s2 的内容拷贝给 s1,替换 s1 的内容 getline(cin, a); = gets(a); 行输入 cout << a < ...
常用函数
简介分享代码,记录学习过程
代码1234567891011121314151617181920212223242526272829#include <bits/stdc++.h>using namespace std;int main() { /* sqrt(n) - 平方根 pow(n,mi) - 幂运算 abs(n) - 绝对值 round(n) - 四舍五入 sort(起始地址,结束地址) 排序 reverse(起始地址,结束地址) 逆序 max_element() / min_element() - 最大/最小值 max_element(起始地址,结束地址) fill(起始地址,结束地址,填充物) 填充 swap(a,b) - 交换两个值 rand() - 生成随机数 time(0) - 获取当前时间 tolower(char) / toupper() - 大小写转换 三目运算符 A ?B : C; A均为bool B,C为值 */ return 0;}
文件的基本操作
简介分享代码,记录学习过程
代码1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#include <bits/stdc++.h>using namespace std;int main() { ofstream outFile("example.txt"); // 创建或打开文件 if (!outFile) { cerr << "无法打开文件!" << endl; return 1; } outFile << "这是第一行文本\n"; outFile << "这是第二行文本\n"; outFile << 12345 << "\n"; outFile.clos ...
最值
简介分享代码,记录学习过程
代码12345678910111213141516171819#include <bits/stdc++.h>using namespace std;int main() { int a[4] = {3, 22, 3, 24}; int max, min = a[0]; for (int i = 0; i < 4; i++) { if (max < a[i]) { max = a[i]; } if (min > a[i]) { min = a[i]; } } cout << max << endl << min; return 0;}
text
简介这是一个用于测试 所有 Markdown 内联格式 的完整文档。它包含了各种文本格式化元素,用于验证解析器的功能完整性。
文本强调这是加粗文本 和 这也是加粗文本
这是斜体文本 和 这也是斜体文本
这是加粗且斜体的文本 和 这也是加粗且斜体的文本
这是删除线文本==这是高亮文本==
这是-列表 something
这是*列表
这是+列表
==这是有序列表==
这也是有序列表
123452341234434
代码相关行内代码:const example = "Hello World"; 和 function() { return true; }
代码块:
1234# 注释function greet(name) { return `Hello, ${name}!`;}
链接和引用这是一个普通链接 和 https://baidu.com
红色文本和Ctrl+C键盘快捷键
小号文本和标记文本
脚注这是一 ...
clang-format
简介一款格式化C程序的软件
配置1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971 ...
ruff
简介
⚡️ 比现有的 linter(如 Flake8)和格式化程序(如 Black)快 10-100 倍
🛠️ 支持pyproject.toml
🤝 Python 3.13 兼容性
⚖️ 与 Flake8、isort 和 Black 的插入奇偶校验
📦 内置缓存,避免重新分析未更改的文件
🔧 修复支持自动纠错(例如,自动删除未使用的导入)
📏 超过 800 个内置规则,具有本机重新实现 流行的 Flake8 插件
⌨️ VS Code 等的第一方编辑器集成
🌎 单存储库友好,具有分层和级联配置
安装1uv tool install ruff
配置1
高效管理python的工具uv
简介高效管理python的工具uv
🚀 单一工具可替换pip pip-tools pipx poetry pyenv twine virtualenv
⚡️ 比pip快 10-100 倍。
🗂️ 提供全面的项目管理,具有通用锁定文件。
❇️ 运行脚本,支持内联依赖项元数据。
🐍 安装和管理 Python 版本。
🛠️ 运行并安装作为 Python 包发布的工具。
🔩 包括一个像素兼容接口,可通过 熟悉的 CLI。
🏢 支持货运式工作空间 可扩展的项目。
💾 磁盘空间高效,具有全局缓存 依赖重复数据删除。
⏬ 无需 Rust 或 Python 即可安装。
🖥️ 支持 macOS、Linux 和 Windows。
下载12345# On macOS and Linux.curl -LsSf https://astral.sh/uv/install.sh | sh# On Windows.powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"s ...