到老问题。。。
c++吧
全部回复
仅看楼主
level 9
影圣天
楼主
我们都知道\n和endl的区别是\n不会自动刷新缓存区,而endl会,我也承认这是对的。但是,在c++plus中说到:输出时遇到换行符,程序会刷新输出缓存区。我于是验证:
#include<iostream>
using namespace std;
int main()
{
cout<<'a'<<'\n';
while (1);
}
输出结果:a
事实的确如此,那么用\n和endl的方面貌似没有区别。。。。。大神怎么破
2016年01月01日 01点01分
1
level 13
z什么什么k
所以说别用 std::endl (这是Bjarne Stroustrup的建议:
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#sl50-avoid-endl
)
2016年01月01日 01点01分
2
影圣天
如果我能看懂英文该有多好,英语永远是我的痛
2016年01月01日 01点01分
1