c++换行符有哪些


当前第2页 返回上一页

\r 回车,光标移到当前行的开头,不会换到下一行,如果接着输出的话,本行以前的内容会被逐一覆盖;

1

2

3

4

5

6

7

8

9

10

11

12

13

14

#include <iostream>

using namespace std;   

int main() 

    cout << "this is the first line\n"

    cout << "this is the second line\r"

    cout << "this is the third line\n"

    cout << "this is the fouth line\r"

    cout << "this is the fifth line\n";

    cout<<"First"<<"\n"<<"Second"<<endl;

    cout<<"First123"<<"\r"<<"Second"<<endl; 

    cout<<"这是换"<<endl<<"行符";

    return 0; 

}

结果:

1

2

3

4

5

6

7

8

9

this is the first line

this is the third linee

this is the fifth line

First

Second

Second23

这是换

行符

Presss any key to continue

推荐课程:C语言教程

以上就是c++换行符有哪些的详细内容!

返回前面的内容

相关阅读 >>

如何安装visual C++ 6.0

C++中=和==的区别有哪些?

精选的这19道c/c+面试题,你能答对多少呢? - 个人文章 思否

C++如何获取数值极值的办法

区分C++常量表达式、const、constexpr(附代码)

c语言换行符号是什么?

dev C++是什么

dev C++怎么用

C++趣味程序】之开心消消乐

C++如何比较两个字符串?

更多相关阅读请进入《C++》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...