Hello World! · C++
Ch 2 · Your First C++ Program — card 1 of 2.
Every C++ program starts in main. To print, we use cout (pronounced "see-out"), which comes from the <iostream> library we include at the top. You send text to cout with the << operator, and endl (or "\n") ends the line. The line using namespace std; lets us write cout instead of std::cout — a convenience for beginners.
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
cout << "Welcome to C++!" << endl;
return 0;
}