C++ language with code
What is C++?
C++ is an object-oriented programming language. It was
developed by Bjarne Stoustrup at AT&T Bell Laboratories in Murray Hill, New
Jersey USA, in the early 1980’s. Stroustrup , an admirer of Simula67 and a
strong supporter of C, wanted to combine the best of both the languages that could
support object-oriented programming features and still retain the power and
elegance of C.
What is C++?
Application of C++
·
Since C++ allows us to create hierarchy-related
objects, we can build special object-oriented libraries which can be used later
by many programmers.
·
While C++ is able to map the real-world problem
properly, the C part of C++ gives the language the ability to get close to the
machine-level details.
· It is expected that C++ will replace C as a general-purpose
language in the near future.
A Simple Program:
Code:
#include<iostream> // include header file
using namespace std;
int main()
{
cout<<"Rajan
Shukla";
return 0;
}
OUTPUT:
Rajan Shukla
Comments in CPP:
C++ introduces a new comment symbol // (double slash).
Comments start with a double slash symbol and terminated at the end of the line.
The double slash comment is basically a
single line comment
The C comments symbols /* ,*/ are still valid and are more suitable for
multiline comments
Output Operator
Cout<<”C++ is Better than C .”;
In the above statement causes the string in quotation marks
to be displayed on the screen. This statement introduces two new C++ features ,cout
and <<. The identifier cout ( pronounced as Out’) is a predefined object that represent the
standard output stream in C++.
Program:
#include<iostream>
using namespace std;
int main()
{
cout<<"C++ is Better
than C.";
return 0;
}
OUTPUT:
C++ is Better than C.
--------------------------------
Comments
Post a Comment