[go: up one dir, main page]

0% found this document useful (0 votes)
26 views3 pages

Smart-Notes 45

Uploaded by

amirhamza365214
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

Smart-Notes 45

Uploaded by

amirhamza365214
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Powered by

Procedure-Oriented Programming (POP)

Procedure-Oriented Programming (POP) involves a list of instructions to direct a computer


on what to do in a step-by-step manner.

The concept is built around procedures, which are routines or functions similar to those in
functional programming.

An example of POP is the C Language.

In POP, there is no security feature allowing one program to access another program's
information, demonstrating the absence of access modifiers.

Object-Oriented Programming (OOP)

Object-Oriented Programming (OOP) emphasizes data security and the concept of access
modifiers unlike POP.

C++ is an example of an OOP language, where programs are divided into objects rather
than functions.

Key components of OOP include classes, which serve as templates for objects, and
objects, which are instances of those classes.

For example, a class named "Fruit" can have objects like "Apple," "Banana," and "Mango."

Benefits and Applications of OOP

Benefits of OOP include faster and easier execution of programs and a clearer structure
for program development.

It promotes the DRY (Don't Repeat Yourself) principle, enhancing code maintainability,
modification, and debugging.

Applications of OOP span across User Interface design, Real-Time Systems, Simulation,
Object-Oriented Databases, AI Systems, Neural Networks, and Office Automation systems.

Introduction to C++

C++ is a high-level, object-oriented programming language, initially developed as an


extension of the C Language by Bjarne Stroustrup.

Features of C++ include:

Applications of C++ include Operating Systems, Browsers, Graphics, Banking Applications,


and Database management.

Input and Output Operators in C++

C++ utilizes stream operators for input and output operations: the insertion operator `<<`
for output and the extraction operator `>>` for input.
The `cout` object is used with the insertion operator, while the `cin` object is used with the
extraction operator.

Example: `cout << "hello world"` demonstrates using the insertion operator to output text.

Structure of a C++ Program

A C++ program generally consists of:

Example of a class definition:

Tokens in C++

A token is the smallest meaningful element recognized by the compiler in a program.

Tokens are classified into several categories:

C++ specifically includes additional keywords such as `asm`, `bool`, `class`, and
`const_cast`, among others.

Identifiers in C++

Identifiers are names given to variables, functions, and arrays in C++.

They must begin with a letter or an underscore and can consist of letters, digits, and
underscores.

Certain rules are specified for naming C identifiers:

Example: In `void main() { int a; }`, `main` is a method name and `a` is a variable name.

Constants in C++

Constants are values that cannot be modified once defined; they represent fixed values
and are also known as literals.

Types of constants include:

Examples of declarations include:

Special Symbols in C++

Special symbols serve specific purposes in C++ programming:

Operators in C++

Operators are symbols that perform actions on variables and objects. The data on which
they act are called operands.

Types of operators include:

Reference Variables in C++


A reference variable acts as an alias for an already defined variable.

Example:

Features of reference variables include:

Data Types in C++

Data types specify the kind of data a variable can hold and dictate the memory allocated
for it.

Types of data include:

Operators in C++ (continued)

Scope Resolution Operator `::`: Used to access global variables with the same name as
local variables.

Memory Management Operator:

Manipulators: Format output data.

Type Cast Operator: Converts one data type to another.

Expressions in C++

An expression is a combination of variables, constants, symbols, or operators.

Example: `x + y = 5` demonstrates a simple expression.

Types of expressions are to be further detailed based on the context.

You might also like