doc/docs/CPlusPlus-main/09_C++的转义字符.md
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

44 lines
736 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# C++的转义字符
# 1. 转义字符
① 用于表示一些不能显示出来的ASCII字符。
② 我们常用的转义字符有:\n、\\、\t。
```python
#include <iostream>
using namespace std;
int main()
{
//换行符 \n
cout << "hello world\n";
//反斜杠 \\ 要输出反斜杠\要在前面加上一个反斜杠
cout << "\\" << endl;
//水平制表符\t 可以整齐的输出数据
cout << "aaaa\thellowworld" << endl;
cout << "aa\thellowworld" << endl;
cout << "aaaaaa\thellowworld" << endl;
system("pause");
return 0;
}
```
运行结果:
- hello world
- \
- aaaa hellowworld
- aa hellowworld
- aaaaaa hellowworld
- 请按任意键继续. . .