一个cout语句可以分写成若干行。如
cout<<"This is a simple C++ program."<<endl;
可以写成
cout<<"This is " //注意行末尾无分号
<<"a C++ "
<<"program."
<<endl; //语句最后有分号
也可写成多个cout语句,即
cout<<"This is "; //语句末尾有分号
cout <<"a C++ ";
cout <<"program.";
cout<<endl;
以上3种情况的输出均为
This is a simple C++ program.