The cout
object, together with the <<
operator, is used to output values/print text:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}
Try it Yourself »
You can add as many cout
objects as you want. However, note that it does not insert a new line at the end of the output:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
cout << "I am learning C++";
return 0;
}
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!