当前第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++换行符有哪些的详细内容!
返回前面的内容
相关阅读 >>
【C++趣味程序】之开心消消乐
c#调用C++ 动态链接库dll
C++中main函数的返回值类型是什么
C++如何获取数值极值的办法
C++实现逐行读取txt文件中的字符串以及文件文本的复制
perl和C++的区别是什么?perl和C++的简单比较
详解C++虚成员函数和动态联编
技术解答面向对象的初步认识(C++ 类)
简单工厂factory
C++中的四种强制类型转换_基本用法及使用场景
更多相关阅读请进入《C++》频道 >>
转载请注明出处:木庄网络博客 » c++换行符有哪些