Saying "Hello World!"
The obligatory first program
PRE C++20 method
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
C++20 and newer method
import <iostream>;
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
Restriction | |
---|---|
Both version compile to the same program:Figure 1. Hello World!
