SlideShare a Scribd company logo
Advantages of C++
C++ programming language has many advantages over other
languages. Some of these advantages are listed as follows.
 Rich Standard Library: C++ language provides the users
with a rich and useful Standard Template Library (STL). This
library has a lot of in-built methods and data structure
templates to make coding in this language efficient and quick.
 OOPS Concepts: C++ language provides users with
Object-Oriented Programming concepts like class, object,
abstraction, polymorphism and much more. Hence, it acts as
a modified and better version of C programming language.
 Faster Performance: C++ language is faster in
comparison to other languages like Python, Go, C#, and many
more. This makes it very useful in embedded systems and
gaming processors.
 Efficient Compiler: C++ is a compiled language. C++
compiler is very versatile, and it can accept both procedural
programs as well as object oriented programs.
 Hardware Independent: C++ language is independent of
any hardware or system design. C++ programs work on any
system that has a C++/GCC compiler installed and enabled in
it.
 Large Support Base: C++ is one of the most widely used
programming languages across the globe. It has a vast
community of developers and programmers. This can be
explored on platforms like Github, Reddit, Discord, DEV, Stack
Overflow, and many more.
Advantages of C++
Disadvantages of C++
C++ programming language also has some disadvantages,
which are listed below:
 Error Detection: C++ provides the facility of low-level design
and is very close to the hardware of the system. Hence, this may
lead the user to carry out small errors that are difficult to observe
and detect.
 Large Syntax: C++ has a very lengthy code base, and many
programmers find it difficult to write such a lengthy syntax. This
has drawn backlash from the user-base of languages like Python,
Go, etc., which are easier to code and simpler to execute.
 Learning Curve: As compared to Python and Go, C++ has a
very steep learning curve. Users feel that the initial building phase
is very tough to learn, and there are many concepts that beginners
find difficult to understand.
Facts about C++
 C++ language was invented at the AT&T Bell Labs, the same place
where C language was invented.
 C++ language is heavily used in NASA, where it finds applications in
flight software and command design.
 C++ is the successor of the C language. The name C++ has been taken
from C only, and the increment operator ('++') signifies that this language
is the next version of C.
 C++ is widely used in areas like game development, server-side
networking, TCP/IP connections, low-level design, and many more.
 C++ programs begin by executing the main() function, and other
functions are redirected using the main() function only.
 C++ has inherited almost all features of C, and it has incorporated
OOPS concepts from Simula68 programming language.
 C++ does not support pure object-oriented programming. Programs
can be executed without the use of classes and objects, just like in
procedural languages.
 There are many languages that are conceptualized using C++, and
some of those are C#, Java, JavaScript, and many more.
Structure of C++ program
#include <iostream.h>
using namespace std;
int main()
{
float number1, number2, sum, average;
cout << ”Enter two numbers: ”; //prompt
cin >> number1; // Reads numbers
cin >> number2; //from keyboard
sum = number1 + number2;
average = sum/2;
cout<< ” Sum= “ <<sum<< ”/n”;
cout<< ” Average=” <<average<< ”n”;
return 0;
}
The output of program is:
Enter two numbers: 6.5 7.5
Sum = 14
Average = 7
Example Program on C++
Input operator of the C++ Programming
The statement
cin >> number1;
The identifier cin is a predefined object in C++ that
corresponds to the standard input stream. Here, this stream
represents the keyboard.
The operator >> is known as extraction or get from operator. It
takes the value from the keyboard and assigns it to the variable
on its right.
Object Insurant operator Variable
>>
cin 45.5
Keyboard
Cascading of I/O operators
We have used the extraction operator << repeatedly in the last
two statements for printing results. The statement
cout<< “Sum= “ << sum << “n”;
first sends the string “Sum=” to cout and then sends the value of sum.
Finally, it sends the newline character so that the next output will be in
the new line. The multiple use of << in one statement is called
cascading.
Object
Extraction operator
Variable
sum << cout
45.5
Keyboard
An Example with Class
One major features of Oops with C++ is classes. They
provide a method of binding together data and functions
which operate on them. Like structures in C, classes are user-
defined data types.
The below program defines person as a new data of
type class. The class person includes two basic data type
items and two functions to operate on that data. These
functions are called member functions. The main program
uses person to declare variables of its type. Class variables
are known as objects. Here, p is an object of type person.
Class objects are used to invoke the functions defined in that
// Program shows the use of class in C++ program
#include <iostream.h>
using namespace STD;
class person // NEW DATA TYPE
{
char name[30];
int age;
public:
void getdata(void);
void display(void);
};
void person :: getdata(void)// MEMBER FUNCTION
{
cout<< “Enter name: ”;
cin>> name;
cout<< “Enter age: ”;
cin>>age;
}
void person :: display(void)// MEMBER FUNCTION
{
cout<<”nName: ”<<name;
cout<<”nAge: ”<<age;
}
int main()
{
person p; // OBJECT OF TYPE person
p.getdata();
p.display():
return 0;
}
The output of program is:
Enter Name: Ravinder
Enter Age: 30
Name: Ravinder
Age: 30

More Related Content

PDF
Object oriented programming c++
PPTX
Object oriented programming 7 first steps in oop using c++
PPTX
C+Comprehensive overview of the IoT system aims, architecture, challenges, ap...
PDF
The C++ Programming Language
PPTX
C++ language basic
PPTX
object oriented programming language fundamentals
PPTX
Unit 1 of c++ part 1 basic introduction
PDF
3.-Beginnign-with-C.pdf.Basic c++ Learn and Object oriented programming a to z
Object oriented programming c++
Object oriented programming 7 first steps in oop using c++
C+Comprehensive overview of the IoT system aims, architecture, challenges, ap...
The C++ Programming Language
C++ language basic
object oriented programming language fundamentals
Unit 1 of c++ part 1 basic introduction
3.-Beginnign-with-C.pdf.Basic c++ Learn and Object oriented programming a to z

Similar to Advantage and Disadvantages of C++ programming.pptx (20)

PPTX
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
PPTX
Procedure Oriented programming Object Oriented programming Basic Concept of ...
PPTX
Session 1 - c++ intro
PPTX
Introduction to C++
PPTX
Object Oriented Programming Using C++.pptx
PPTX
abuzar Seminar Sir Sayyyed college bcs TY
PDF
PDF
Prog1-L1.pdf
PPTX
Introduction to cpp language and all the required information relating to it
PPT
Payal C++ ppt presentation.ppt college class
PPTX
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
PPTX
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
PPTX
C and C++ programming basics for Beginners.pptx
PDF
C++ Programming with examples for B.Tech
PPTX
lecture NOTES ON OOPS C++ ON CLASS AND OBJECTS
PPTX
AS TASKS #8
PDF
Programmingwithc 131017034813-phpapp01
PPTX
C vs c++
PPTX
C++ with student management system project
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
Procedure Oriented programming Object Oriented programming Basic Concept of ...
Session 1 - c++ intro
Introduction to C++
Object Oriented Programming Using C++.pptx
abuzar Seminar Sir Sayyyed college bcs TY
Prog1-L1.pdf
Introduction to cpp language and all the required information relating to it
Payal C++ ppt presentation.ppt college class
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C and C++ programming basics for Beginners.pptx
C++ Programming with examples for B.Tech
lecture NOTES ON OOPS C++ ON CLASS AND OBJECTS
AS TASKS #8
Programmingwithc 131017034813-phpapp01
C vs c++
C++ with student management system project
Ad

Recently uploaded (20)

PDF
01-Introduction-to-Information-Management.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Yogi Goddess Pres Conference Studio Updates
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Cell Types and Its function , kingdom of life
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Trump Administration's workforce development strategy
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
RMMM.pdf make it easy to upload and study
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
01-Introduction-to-Information-Management.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Yogi Goddess Pres Conference Studio Updates
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Final Presentation General Medicine 03-08-2024.pptx
Cell Types and Its function , kingdom of life
Pharma ospi slides which help in ospi learning
Microbial diseases, their pathogenesis and prophylaxis
Trump Administration's workforce development strategy
human mycosis Human fungal infections are called human mycosis..pptx
Computing-Curriculum for Schools in Ghana
GDM (1) (1).pptx small presentation for students
Anesthesia in Laparoscopic Surgery in India
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
RMMM.pdf make it easy to upload and study
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Ad

Advantage and Disadvantages of C++ programming.pptx

  • 1. Advantages of C++ C++ programming language has many advantages over other languages. Some of these advantages are listed as follows.  Rich Standard Library: C++ language provides the users with a rich and useful Standard Template Library (STL). This library has a lot of in-built methods and data structure templates to make coding in this language efficient and quick.  OOPS Concepts: C++ language provides users with Object-Oriented Programming concepts like class, object, abstraction, polymorphism and much more. Hence, it acts as a modified and better version of C programming language.  Faster Performance: C++ language is faster in comparison to other languages like Python, Go, C#, and many more. This makes it very useful in embedded systems and gaming processors.
  • 2.  Efficient Compiler: C++ is a compiled language. C++ compiler is very versatile, and it can accept both procedural programs as well as object oriented programs.  Hardware Independent: C++ language is independent of any hardware or system design. C++ programs work on any system that has a C++/GCC compiler installed and enabled in it.  Large Support Base: C++ is one of the most widely used programming languages across the globe. It has a vast community of developers and programmers. This can be explored on platforms like Github, Reddit, Discord, DEV, Stack Overflow, and many more. Advantages of C++
  • 3. Disadvantages of C++ C++ programming language also has some disadvantages, which are listed below:  Error Detection: C++ provides the facility of low-level design and is very close to the hardware of the system. Hence, this may lead the user to carry out small errors that are difficult to observe and detect.  Large Syntax: C++ has a very lengthy code base, and many programmers find it difficult to write such a lengthy syntax. This has drawn backlash from the user-base of languages like Python, Go, etc., which are easier to code and simpler to execute.  Learning Curve: As compared to Python and Go, C++ has a very steep learning curve. Users feel that the initial building phase is very tough to learn, and there are many concepts that beginners find difficult to understand.
  • 4. Facts about C++  C++ language was invented at the AT&T Bell Labs, the same place where C language was invented.  C++ language is heavily used in NASA, where it finds applications in flight software and command design.  C++ is the successor of the C language. The name C++ has been taken from C only, and the increment operator ('++') signifies that this language is the next version of C.  C++ is widely used in areas like game development, server-side networking, TCP/IP connections, low-level design, and many more.  C++ programs begin by executing the main() function, and other functions are redirected using the main() function only.  C++ has inherited almost all features of C, and it has incorporated OOPS concepts from Simula68 programming language.  C++ does not support pure object-oriented programming. Programs can be executed without the use of classes and objects, just like in procedural languages.  There are many languages that are conceptualized using C++, and some of those are C#, Java, JavaScript, and many more.
  • 6. #include <iostream.h> using namespace std; int main() { float number1, number2, sum, average; cout << ”Enter two numbers: ”; //prompt cin >> number1; // Reads numbers cin >> number2; //from keyboard sum = number1 + number2; average = sum/2; cout<< ” Sum= “ <<sum<< ”/n”; cout<< ” Average=” <<average<< ”n”; return 0; } The output of program is: Enter two numbers: 6.5 7.5 Sum = 14 Average = 7 Example Program on C++
  • 7. Input operator of the C++ Programming The statement cin >> number1; The identifier cin is a predefined object in C++ that corresponds to the standard input stream. Here, this stream represents the keyboard. The operator >> is known as extraction or get from operator. It takes the value from the keyboard and assigns it to the variable on its right. Object Insurant operator Variable >> cin 45.5 Keyboard
  • 8. Cascading of I/O operators We have used the extraction operator << repeatedly in the last two statements for printing results. The statement cout<< “Sum= “ << sum << “n”; first sends the string “Sum=” to cout and then sends the value of sum. Finally, it sends the newline character so that the next output will be in the new line. The multiple use of << in one statement is called cascading. Object Extraction operator Variable sum << cout 45.5 Keyboard
  • 9. An Example with Class One major features of Oops with C++ is classes. They provide a method of binding together data and functions which operate on them. Like structures in C, classes are user- defined data types. The below program defines person as a new data of type class. The class person includes two basic data type items and two functions to operate on that data. These functions are called member functions. The main program uses person to declare variables of its type. Class variables are known as objects. Here, p is an object of type person. Class objects are used to invoke the functions defined in that
  • 10. // Program shows the use of class in C++ program #include <iostream.h> using namespace STD; class person // NEW DATA TYPE { char name[30]; int age; public: void getdata(void); void display(void); }; void person :: getdata(void)// MEMBER FUNCTION { cout<< “Enter name: ”; cin>> name; cout<< “Enter age: ”; cin>>age; } void person :: display(void)// MEMBER FUNCTION { cout<<”nName: ”<<name; cout<<”nAge: ”<<age; }
  • 11. int main() { person p; // OBJECT OF TYPE person p.getdata(); p.display(): return 0; } The output of program is: Enter Name: Ravinder Enter Age: 30 Name: Ravinder Age: 30