Get start with C++

C++ is one of the best programming language which will help to start learning programming easily. Many programmers started programming with the help of C++. It is an object oriented language and if a person have knowledge in C++ can learn any programming languages like java, paskal etc. I would like to give some short examples for C++.


#include<iostream.h>
void main()
{
cout<<"Hello world";
}
This is a very simple program which tell the computer to show the message Hello world. Through Cout we display a message. Instead of hello world if you enter any other thing then it will be the thing that shown. Another simple program is below.

#include<iostream.h>

void main()

{

int a,b,c;

cout<<" Enter two numbers:";
cin>>a>>b;

c=a+b;

cout<<"The sum is:"<<c;

As a said this is a very simple which ask the users to enter two numbers. After entering when we click enter button this program will show that the sum is: the result i.e for eg: we entered 4 and 5 as the numbers when we click enter the program will execute and show that the sum is:9. Like this there are many other functions are also there. If we want a program with some condition then we can use 'if else conditional statement'. Below is a program which is to find that which number is greater among 3 user defined numbers.

#include<iostream.h>
void main()
{
int a,b,c, max
cout<<"Enter 3 numbers:";
cin>>a>>b>>c;

if(a>b)
{
  if(a>c)
 {
    cout<<c<<" is large";
  }
else
{
cout<<a<<" is large";
 }
}
else if(a<b)
{
  if(b>c)
   {
      cout<<b<<" is large";
    }
else
  {
     cout<<c<<" is large";
   }
}
else
{
cout<<"Can't tell";
}
}

 This program will tells which number is greatest among the three number we imputed to the computer. 

Like this it is very easy to learn C++ programming. What here I given is just only a small portion of C++, you can access other sites like cppforschools, Tutorial Point for learning more about different functions of this programming language. The tutorials will include flow of control, data handling files, stack and queue, array, inheritance etc. After learning all this you will able to create programs on your own. It is very easy for you to learn java if you have knowledge in C++. All the best.