Computer Programming: C++

your basic program in C++ and what each part of it means:

  1. #include iostream.h

numbers something>
  • int main()

  • {

  • cout << "hello world\n";

  • return 0;

  • }

  • Line 1: this is the most essential part of the program, the entire line tells your processor & computer that you are writing with C++, it must be included in the first line of every C++ program.

    Line 2: this declares the main function of the program. In order for a function to be carried out it must be declared first.

    Lines 3-6: This is the actual program itself, the brackets show the processor where the program starts and ends, cout tells the processor that you want text out put and \n serves the same purpose as pushing enter would in a text document. Finally return 0 tells the processor that your program is done.

    Note: Line 4 ended with semi-colon to let the processor know that that individual operation of the program was over.

    Recommended Reading:

    Sams' Teach Yourself C++ by Jesse Liberty