Related Posts Plugin for WordPress, Blogger...

About

Follow Us

Sunday, 8 February 2015

Introduction: 

C++ is an object oriented programming (OOP) language, developed by “Bjarne Stroustrup”, and is an extension of C language, starting in 1979 at Bells labs. C++ was originally named “C with Classes”, adding object oriented features, such as Objects, Classes, Abstraction, Encapsulations, Inheritance, Polymorphism, Overloading and other enhancements to the C programming language.  It was renamed to C++ in 1983.
Working Example of C++:
Now let’s create our first simple program to calculate the sum of two numbers in C++ Language 
#include<iostream.h>
#include<conio.h>
void main()
{
 clrscr();
 int a,b,sum;
 cout<<"Enter first number= ";
 cin>>a;
 cout<<"Enter second number= ";
 cin>>b;
 sum=a+b;
 cout<<"\nSum of " <<a<<" and "<<b<<" = "<<sum;
 getch();
}

Output:
Enter first number=10
Enter second number=15


Sum of 10 and 15 = 25
Categories:

0 comments:

Post a Comment