C++中ends,flush,endl 用法区别
作者:互联网
- ends: 终止字符串
- endl: 终止一行 并刷新缓冲区
- flush: 刷新缓冲区的数据
#include <iostream> int main() { using namespace std; cout << "a" ; cout << "b" <<ends; cout << "c" <<endl; cout << "e" << flush; cout << "f" << flush; cout << "g" ; cout << "h" <<ends; cout << "i" << flush; cout << "j" <<endl; return 0; } 结果 ab c efgh ij
标签:ends,flush,C++,终止,刷新,缓冲区,endl 来源: https://www.cnblogs.com/kunyuwu/p/15650444.html