Free Source Code and Tutorials

Custom Search

02 – C++ : Basic Syntax


C++ program can be intimidating at first but once you start learning about it, you’ll be surprised that it’s only simple and not that complicated like what you think it is. C++ means a collection of objects that interacts through each other’s methods. Now, let’s briefly discuss the object, class, methods and Instance variables.


  • A class can be defined as a blueprint for a data type that simply describes the states and behavior that such an object type supports.
  • An object contains states and behaviors. It is also defined as an instance of a class.
  • Basically, a method is a behavior. Many methods can be contained by a class but in the method, it is where the data is manipulated,logics are written and where all actions are performed.
  • An instance variable is a variable which can be associated with an instance of a class.



Basic Syntax

#include <iostream>
using namespace std;

int main()
   cout << "Hello World";
   return 0;

Let us look the executed program above.

  • #include <iostream> – set objects for controlling the reading from and writing to the standard streams.
  • using namespace std; – is a command use for calling the standard library.
  • main() – it is where the execution of your codes started.
  • cout << “Hello World”; – it will display to the console.
  • return 0; – returns where it started. 


C++ Reserved Words

Below are the following list of reserved words in C++. These are not advisable to use as a constant, a variable or the name of the method.

auto else new this
asm enum operator throw
break explicit private true
bool export protected try
case extern public typedef
catch false register typeid
class float reinterpret_cast typename
char for return union
const friend short unsigned
const_cast goto signed using
continue if sizeof virtual
default inline static_cast void
delete int static volatile
do long struct wchar_t
double mutable switch while
dynamic_cast namespace template


Facebook Comments
(Visited 5 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: