doc/docs/CPlusPlus-main/09_C++的转义字符.ipynb
sairate fa9377e4ae docs(book): 添加现代 C++教程及相关代码
- 新增现代 C++ 教程的 Preface 章节,包括英文和中文版本
- 添加 C++ Primer 练习代码
- 新增 Learn C++ 教程的 C++ 开发简介章节
- 添加头文件解析文档
- 更新 mkdocs.yml,包含新教程的目录结构
- 修改项目设置,使用 Python 3.10环境
2025-07-08 09:52:45 +08:00

107 lines
2.2 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# C++的转义字符"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 1. 转义字符"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"① 用于表示一些不能显示出来的ASCII字符。\n",
"\n",
"② 我们常用的转义字符有:\\n、\\\\、\\t。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#include <iostream>\n",
"using namespace std;\n",
"\n",
"int main()\n",
"{\n",
"\n",
" //换行符 \\n\n",
"\n",
" cout << \"hello world\\n\";\n",
"\n",
" //反斜杠 \\\\ 要输出反斜杠\\时,要在前面加上一个反斜杠\n",
"\n",
" cout << \"\\\\\" << endl;\n",
"\n",
" //水平制表符\\t 可以整齐的输出数据\n",
" cout << \"aaaa\\thellowworld\" << endl;\n",
" cout << \"aa\\thellowworld\" << endl;\n",
" cout << \"aaaaaa\\thellowworld\" << endl;\n",
"\n",
" system(\"pause\");\n",
"\n",
" return 0;\n",
"\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"运行结果:\n",
" - hello world\n",
" - \\\n",
" - aaaa hellowworld\n",
" - aa hellowworld\n",
" - aaaaaa hellowworld\n",
" - 请按任意键继续. . ."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.6.3",
"language": "python",
"name": "python3.6.3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
}
},
"nbformat": 4,
"nbformat_minor": 4
}