Disadvantages of C++
- The C++ program is complex during a very large high-level program, and C++ is employed for platform-specific applications commonly, For the actual OS or platform, the library set is typically chosen.
- It program can’t support garbage pickup, It’s not secure because it’s a pointer, friend function, and global variable and it has no support for threads built-in.
- It is a complex and powerful language that can take time to learn and master, especially for beginners who are new to programming.
Example Code: Simple program to add two number
C++
#include <iostream> int main() { // Declare variables to store user input double num1, num2; // Prompt the user to enter the first number std::cout << "Enter the first number: " ; std::cin >> num1; // Prompt the user to enter the second number std::cout << "Enter the second number: " ; std::cin >> num2; // Calculate the sum of the two numbers double sum = num1 + num2; // Display the result std::cout << "The sum of " << num1 << " and " << num2 << " is: " << sum << std::endl; // Return 0 to indicate successful program execution return 0; } |
Output:
Enter the first number: 10
Enter the second number: 20
The sum of 10 and 20 is: 30
C++ File Format | .cpp Extension
C++ is a general-purpose programming language that extends C with features such as classes and objects, allowing for object-oriented programming. A C++ programming language file has a .cpp file extension. It allows developers to write clean and efficient code for large applications and software development, game development, and operating system programming.
Table of Content
- History of C++
- Features of C++
- Syntax of C++
- Advantages of C++
- Disadvantages of C++
- Conclusion