Computer Wiki
Advertisement

Here you'll learn a very basic program. All you'll need is:

After get what I said, start coding!

// my first program in C++

#include <iostream>

int main ()
{
  std::cout << "Hello World!" << std::endl;
}

We could also write the above code like this

#include <iostream>
using namespace std;

int main()
{
  cout << "Hello World!" << endl;
  return 0;
}

but the line 2 involves the concept of Namespaces, which is something a little complex for novice programmers! In C++, unlike C, the return keyword on the main() function is optional.

Advertisement