0% found this document useful (0 votes)
4 views

Fundamentals of Programming Reviewer

The document provides an overview of programming languages, detailing their generations from machine language to fifth-generation languages, including their characteristics and uses. It introduces programming paradigms such as imperative, functional, and object-oriented programming, along with key concepts like algorithms, pseudocode, and flowcharts. Additionally, it covers the C++ programming language, its history, syntax, data types, operators, and the structure of a C++ program.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Fundamentals of Programming Reviewer

The document provides an overview of programming languages, detailing their generations from machine language to fifth-generation languages, including their characteristics and uses. It introduces programming paradigms such as imperative, functional, and object-oriented programming, along with key concepts like algorithms, pseudocode, and flowcharts. Additionally, it covers the C++ programming language, its history, syntax, data types, operators, and the structure of a C++ program.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Fundamentals of o Second - Generation Language /

Programming (COMP 102) 2G


- “Assembler language”
Introduction to Programming - contains human-readable
- Programming is writing computer notations that can be further
code to create a program, to solve converted to machine language
a problem. Programs are created using an assembler.
to implement algorithms.
- Algorithms can be represented as Assembler - converts assembly
pseudocode or a flowchart, and level instructions to machine-level
programming is the translation of instructions.
these into a computer program. Programmers can write the code
using symbolic instruction codes
What is a Programming Language? that are meaningful abbreviations
of mnemonics. It is also known as
- An artificial language that a low-level language.
computer understands.
- is made up of series of o Third - Generation Language /
statements that fit together to 3GL
form instructions. - “Procedural language”
- It tells a computer what to do. - consists the use of a series of
Statements - is a single line/word code English-like words that humans
that performs a specific action or task. can understand easily, to write
instructions.
STATEMENTS PURPOSE
print Output a message - A program in this language
input Get data from the user needs to be translated into
machine language using a
Generation of Programming Language Compiler/ Interpreter.
Ada Lovelace - considered the first
computer programmer. o Fourth - Generation Language /
4GL
- “Non-procedural language”
- Enables users to access the
database.
- human-friendly to understand.
o First - Generation Language / 1G o Fifth - Generation Language /
- “Machine language” 5GL
- machine-dependent. - based on the concept of artificial
- statements are written in binary intelligence.
code (0/1 form). - Uses the concept that rather
than solving a problem
algorithmically, an application o Logic Programming Paradigm
can be built to solve it based on - “Abstract Model of Computation”.
some constraints. o It would solve logical problems
- Parallel Processing & like puzzles, series etc.
superconductors are used for o It allows to infer conclusions
this type of language to make from a given knowledge base,
real artificial intelligence. enabling them to answer queries
Introduction to Programming based on logical reasoning.
Paradigms o Main emphasize is on
knowledge base and the
Paradigm problem
- Termed as a method to solve
some problem or do some tasks. o Object – Oriented Programming
- An approach to solve problem Paradigm
using programming language. o written as a collection of classes
- Solving a problem using tools and object which are meant for
and techniques that are communication.
available to us following some o The smallest and basic entity is
approach. object, and all kind of
computation is performed on the
o Imperative Programming objects only.
Paradigm
- one of the oldest programming o Concurrent and Distributed
paradigm. It features close Programming Paradigm
relation to machine architecture. o Allows for the execution of two
- It works by changing the or more operations at the same
program state through time.
assignment statements.
- It performs step by step task by Concepts of Programming
changing state. The main focus is
on how to achieve the goal. What is a Program?
o Made up of statements that the
programming language knows
o Functional Programming and understands.
Paradigm o Puts one or more statements
- its roots in mathematics and it is together to form an instruction.
language independent.
- The execution of series of
mathematical functions.
o Encapsulation
Six stages in developing a computer o bundles together the state
program: information (attributes) and
1. Problem Definition behaviour (methods) of an object
2. Problem Analysis into a single logical unit.
3. Algorithm Development
4. Coding and Documentation o Inheritance
5. Testing & Debugging o process to which objects can
6. Maintenance acquire (inherit) the properties of
objects of other class.
Introduction to Object Oriented
Programming
o Polymorphism
o Object-Oriented Programming
o the ability to process objects
(OOP) is a programming differently depending on their
paradigm centered around data type or class
objects and classes.
o allows developers to model real- Key Benefits of OOP
world entities and their  Modularity
interactions in a way that makes  Reusability
code more modular, reusable,  Maintainability
and maintainable.  Abstraction

OOP Concepts Introduction to C++


o Object - an entity that can be o C++ - a high-level, general-
viewed as either concrete or purpose programming language
abstract. that was designed as an
o Class - representation or an extension of the C programming
“abstraction” of an object. language.
To describe how a house
History of C++
(the object) will be built or
structured, you need a Early Beginnings and C Language:
blueprint (the class).
OOP Key Features o C Language Origins (1972):
o Abstraction o C programming language was
o to hide all but the relevant developed by Dennis
information (to the problem at Ritchie at Bell Labs in 1972 as an
hand) about an object in order to evolution of the earlier B
reduce complexity and increase language, which itself was
efficiency. derived from BCPL. C was
primarily designed for system
programming and played a crucial
role in the development of
the Unix operating system. Algorithms
o Creation of C++ (1980s): o A specific set of well-defined,
o C++ was developed by Bjarne simple mathematical and logical
Stroustrup at Bell Labs, beginning procedures that can be followed
in 1979, with the aim of to solve a problem in a finite
adding object-oriented number of steps.
features to the existing C
language. Pseudocodes
o Initially named "C with o describing an algorithm without
Classes," the language focused on use of any specific programming
extending C by introducing language syntax.
classes, which facilitated data o cannot be executed on a real
abstraction and encapsulation. computer, but it models and
o In 1983, the language was resembles real programming
officially renamed C++, with the code.
"++" symbol signifying its
evolution from C. Flowchart
o a graphical representation of an
Applications of C++ algorithm, workflow, or process.
o System Software: Operating
History of Flowchart
systems, device drivers, and other
o 1920s – ‘30s: Flowcharts began
system-level software.
o Application Software: Desktop to be used for documenting
applications, graphics software, business processes.
and database management o 1921: Frank and Lillian Gilbreth
systems. introduced the "Flow Process
o Game Development: High- Chart" to the American Society of
performance games and game Mechanical Engineers (ASME).
engines. o 1947: ASME adopted a symbol
o Embedded Systems: Software for system for Flow Process Charts,
embedded devices and real-time derived from the Gilbreths’
systems. original work.
o High-Performance Computing: o Late ‘40s: Herman Goldstine and
Applications requiring intensive John Van Neumann used
computations, such as flowcharts to develop computer
simulations and scientific programs, and diagramming.
research.
Flowchart Symbols Conditional Statements
- o Conditions are statements that
Terminal/Terminator result to a Boolean value. The
Boolean value may either be a
TRUE or FALSE, 0 or 1 value.
- Initialize Conditions are categorized into
two:
1. Logical Operators
- Process 2. Relational Operators

Three basic logic operators that can be


- Decision used for conditional statements:

Logical Operators
AND OR
- Data (Input/Output)

NOT
Nnn - Document o && (AND): Both conditions must
be true
o || (OR): At least one condition
- Stored Data must be true
o ! (NOT): Negates an expression

- Flow Arrow Relational Operators


- Comments or Annotations < Less than

> Greater than

< Less than or equal to


- Predefined Process
=
> Greater than or equal to

A - On-page connector/reference =
= Is equal to
Off- =
page
Link - Off-page connector/reference != Not equal to

< Not equal to


>
C++ Keywords & Identifiers
o C++ Keywords - predefined C++ Data Types
words that have special meanings o Data Types - are declarations for
to the compiler. variables. This determines the
o C++ Identifiers - unique names type and size of data associated
given to variables, classes, with variables.
functions, or other entities by the Data Type Meaning Size (Bytes)
programmer. int Integer 2 or 4
o C++ Variables - a container float Floating 4
(storage area) to hold data. point
double Double 8
o C++ Constants – a value cannot
floating
be changed. For that, we use the
point
const keyword. char Character 1
o C++ Literals – used for wchar_t Wide 2
representing fixed values. Character
 Integers: a numeric literal bool Boolean 1
(associated with numbers) void Empty 0
without any fractional or
exponential part.
3 TYPES: Literals vs Data Types
 decimal o Literals
 octal - fixed values that represent
 hexadecimal specific data.
 Floating-point: a numeric - used directly in expressions or
literal that has either a assignments.
fractional form or an o Data types
exponent form. - defines the kind of data that can
 Character: created by be stored in a variable.
enclosing a single character - specify the size, layout, and
inside single quotation range of values that can be
marks. stored.
 String: a sequence of
characters enclosed in How does this program work?
double-quote marks. o Include Header Files
#include <iostream>
 allows the program to use
input and output
functionalities, such as
cout
o Using Namespace
using namespace std;
 allow access to the Operator Operations
Standard Library's classes, + Additional
functions, and objects - Subtraction
without needing to prefix * Multiplication
them with std:: / Division
% Modulo Operation (Remainder after
o Define the Main Function Division)

int main() { Increment and Decrement Operators


 Every C++ program must o ++ increases value of the operand
have a main() function by 1.
where execution starts: o – decreases it by 1
o Output with cout
cout << "Hello World!"; 2. C++ Assignment Operators
 to display output on the Assignment Operators are used to
screen. assign values to a variable.
 The << operator is used to For example, a = 5;
send the string "Hello  We have assigned a value of 5 to
World!" to the standard the variable a.
Operators Example Equivalent to
output.
= a = b; a = b;
o Return Statement
+= a += b; a = a + b;
return 0;
-= a -= b; a = a - b;
 indicates that the program
*= a *= b; a = a * b;
has completed
/= a /= b; a = a / b;
successfully.
%= a %= b; a = a % b;
o Closing the Main Function
}
3. C++ Relational Operators
 close the main() function
Relational Operators are used to
with a closing curly
check the relationship between two
operands.
For example, a > b;
 > is a relational operator. It
checks if a is greater than b or
not. If the relation is true, it
returns 1 whereas if the relation
bracket: is false, it returns 0.
Operators Meaning
1. C++ Arithmetic Operators == Is equal to
Arithmetic Operators are used to != Not equal to
perform arithmetic operations on > Greater than
variables and data. < Less than
>= Greater than or
equal to
<= Less than or equal
to

4. C++ Logical Operators


Logical Operators are used to check
whether an expression is true or
false. If the expression is true, it
returns 1 whereas if the expression
is false, it returns 0.
Operators Example Meaning
&& expression1 Logical AND.
&& True only if all
expression2 the operands
are true.
watermark ni ayi.
II expression1 Logical OR.
II True if at least
expression2 one of the
operands is
true
! !expression Logical NOT.
True only if
the operand is
false.

You might also like