Hello World in C plus plus

From LQWiki
Jump to: navigation, search

Hello World is the typical minimum-function program that prints a message and exits successfully. This is an example written in C++.

main.cpp

#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
  cout << "Hello World!";
  return 0;
}

Build and run your program:

g++ -o hello main.cpp && ./hello