previous |
start |
next
Compiling a Simple Program
- #include<iostream> - read the file iostream that contains the
definition for the stream input/output package.
- using namespace std; - all names in
the program belong to the "standard namespace"
- int main () { ... } defines a
function called main. A function is a collection of
instructions that carry out a particular task.
- The statements (instructions) inside the
body (inside the curly braces { ... }) of the main
function are executed one by one.
- Each statement ends with a semicolon
;
- The sequence of characters enclosed in
quotations marks ("Hello, World\n") is called a
string.
- Escape sequence\n indicates a
newline.
- Use \" to display quotes.
- return denotes the end of the main
function. The zero value is a signal that the program ran
successfully.
previous |
start |
next