C++ language with code

What is C++?

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.

   C++ is a superset of C. Most of what we already know about C applies to C++ also. The  most important facilities that C++ adds on to C classes, inheritance , function overloading and operator overloading. These features enable creating of abstract data types, inherit properties from existing data type and support polymorphism thereby making C++ a truly object-oriented language.

 

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.

--------------------------------

C language with code




Comments

Popular posts from this blog

CYBER SECURITY & CRACKING PASSWORDS

"The Dark Side of Social Media: How It Fuels Digital Addiction and Impacts Mental Health"

Online Platforms to Learn Coding