Basic Syntax and Structure of C++
#include <iostream>
|
# |
Directory |
|
include |
should include this in the program |
|
iostream |
Standard Input/Output header file |
|
int |
datatype |
|
main() |
function
name. It is the execution point of my program. i.e it is the place where my
program begins. |
|
{ } |
Specifies a Block of code |
|
return |
It intimates
to the compiler that the program has reached the end of the line |
|
; |
Termination Statement |
Example:
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
int a = 5, b = 3;
int sum = a + b;
cout << "Sum of " << a << " and " << b << " is: " << sum << endl;
return 0;
}
Comments