C3

Cards (44)

  • What is the primary programming paradigm of C++?
    - Object-oriented.
  • What term describes the capability of C++ to handle both low-level and high-level programming tasks?
    Middle-level language.
  • What feature allows developers to create reusable and flexible code in C++?
    Templates.
  • Which library in C++ provides containers and algorithms for working with data?
    Standard Template Library (STL).
  • What type of programming does C++ support for creating classes and objects?
    Object-oriented programming.
  • What is the primary purpose of exception handling in C++?**
    - Handling errors and unexpected situations.
  • What language was C++ developed as an enhancement of?
    C++ programming language.
  • What year was C++ developed?
    1983.
  • What level of programming tasks is C++ particularly suitable for?
    Both low-level system programming and high-level application development.
  • KEY FEATURES OF C++
    • Object Oriented Programming
    • TEMPLATES
    • STANDARD TEMPLATE LIBRARY
    • EXCEPTION HANDLING
  • Machine Independent but Platform Dependent: A C++ executable is not platform-independent (compiled programs on Linux won’t run on Windows), however they are machine independent.
  • Mid-level language: It is a mid-level language as we can do
    both systems-programming (drivers, kernels, networking etc.)
    and build large-scale user applications (Media Players,
    Photoshop, Game Engines etc.)
  • Rich library support: Has a rich library support (Both standard ~ built-in data structures, algorithms etc.) as well 3rd party libraries (e.g. Boost libraries) for fast and rapid development.
  • Speed of execution: C++ programs excel in execution speed.
    Since, it is a compiled language, and also hugely procedural.
    Newer languages have extra in-built default features such as
    garbage-collection, dynamic typing etc. which slow the
    execution of the program overall. Since there is no additional
    processing overhead like this in C++, it is blazing fast.
  • Pointer and direct Memory-Access: C++ provides pointer support which aids users to directly manipulate storage address. This helps in doing low-level programming (where one might need to have explicit control on the storage of variables).
  • Object-Oriented: One of the strongest points of the language
    which sets it apart from C. Object-Oriented support helps C++ to make maintainable and extensible programs. i.e. Large-scale applications can be built. Procedural code becomes difficult to maintain as code-size grows.
  • Compiled Language: C++ is a compiled language, contributing to its speed.
  • Object-Oriented Programming:
    C++ is an object-oriented
    programming language, which means that it allows you to define classes and objects to model real-world entities and their behavior.
  • Strong Type System: C++ has a strong type system, which means that variables have a specific type and that type must be respected in all operations performed on that variable.
  • Low-level Access: C++ provides low-level access to system
    resources, which makes it a suitable choice for system
    programming and writing efficient code.
  • Standard Template Library (STL): The STL provides a large set of
    pre-written algorithms and data structures that can be used to
    simplify your code and make it more efficient.
  • Cross-platform Compatibility: C++ can be compiled and run on
    multiple platforms, including Windows, MacOS, and Linux, making it a versatile language for developing cross-platform
    applications.
  • Performance: C++ is a compiled language, which means that code is transformed into machine code before it is executed. This can result in faster execution times and improved performance compared to interpreted languages like Python.
  • Memory Management: C++ requires manual memory management, which can lead to errors if not done correctly. However, this also provides more control over the program’s memory usage and can result in more efficient memory usage.
  • Syntax: C++ has a complex syntax that can be difficult to learn, especially for beginners. However, with practice and experience, it becomes easier to understand and work with.
  • ADVANTAGES OF c++
    • PERFORMANCE
    • OBJECT ORIENTED PROGRAMMING
    • STANDARD TEMPLATE LIBRARY
    • MACHINE INDEPENDENT
    • LARGE COMMUNITY
  • DISADVANTAGES
    • STEEP LEARNING CURVE
    • VERBOSE SYNTAX
    • ERROR-PRONE
  • // COMMENT
    • is used to display additional information about the program. It does not contain any programming logic.
  • #include
    This is a preprocessor directive. It directive tells the compiler to include the content of a file in the source code.
  • using namespace std
    This is used to import the entity of the std namespace into the
    current namespace of the program. The statement using namespace std is generally considered a bad practice. When we import a namespace we are essentially pulling all type definitions into the current scope.
  • int main() { }
    • A function is a group of statements that are designed to perform a specific task. It is the entry point of every C++ program, no matter where the function is located in the program.
  • cout<<
    It is used to display output on the screen. Everything followed by the character << in double quotes ” ” is displayed on the output device. The semi-colon character at the end of the statement is used to indicate that the statement is ending there.
  • return 0
    • This statement is used to return a value from a function and
    indicates the finishing of a function. This statement is
    basically used in functions to return the results of the
    operations performed by a function.
  • Indentation
    This is done to make the
    code more readable. We must always use indentations and comments to make the code more readable.
  • The newline character (\n) is called an escape sequence, and it forces the cursor to change its position to the beginning of the
    next line on the screen. This results in a new line.
  • \t
    Creates a horizontal tab
  • \\
    Inserts a backslash
    character (\)
  • \"
    Inserts a double quote character
  • int - stores integers (whole numbers), without decimals, such as 123 or -123
  • double - stores floating point numbers, with decimals, such as
    19.99 or -19.99