can we concatenate endl with a string in an expression?explain

来源:百度知道 编辑:UC知道 时间:2024/05/15 12:14:41
c++的题
explain

可以的。
endl它就是指'\n',它是个转义字符,也是个字符。
见下面的程序:
#include<iostream.h>
#include<string.h>
void main()
{
char a[10]="sdfg";
strcat(a,"\n");
cout<<a<<endl;

}

最后输出
sdfg

最后有个换行。

我们可以用endl串联在表达式的字符串吗?
应该可以吧。