c++换行符有哪些
\n 换行,光标移到下一行的开头;
\r 回车,光标移到当前行的开头,不会换到下一行,如果接着输出的话,本行以前的内容会被逐一覆盖;
#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; }
结果:
this is the first line this is the third linee this is the fifth line First Second Second23 这是换 行符 Presss any key to continue
推荐课程:C语言教程
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。