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.
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();
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
0 comments:
Post a Comment