History of C Programming Language
History of C Programming Language
Programming language
• It is a language that is used to control the
behavior of a machine particularly
computer.
• It is used to facilitate communication about
task of organizing and manipulating
information
• It is used to express algorithms precisely
Why programming is important??
• Critical reading :Understanding + analysis
• Analytical reading: Step-by-Step
procedures to break complex problem into
small steps
• Creative synthesis: Think about all the
possibilities
Pay attention to details
• Pay attention to all the aspects
• Pay attention to all the calculations
involved in program, their flow, and most
importantly the logic of program
• Understand the fact the computers are
useless
• Don’t assume that reader is intelligent
• Comment your code
Model of a complex system
• Model: Simplified representation of salient
features of something, either tangible or
abstract
• System: Collection of components that
work closely together
• Syntax: Grammatical rules for forming
instructions
• Semantics: Meaning/ interpretation of
instructions.
Instruction written by programmer
• Coded in a specific programming
language
• Programming language allow you to
express yourself more precisely than
natural language
Source code:: All instructions that compute a
program is called source code
e.g. library catalog, ATM, video game.
Algorithm
• Set of instructions used to specify how to
solve a problem
Syntax
• Set of rules that govern the structure of
sentences, instructions
Types of languages
• Typed language: If operation defined for
one data type can’t be performed on
another data type
• Un-typed language: Allow any operation
to be performed on any data type e.g.
assembly language.
Introduction
• C++ is General purpose programming
language
• Mid level language: Combination of both
high level language and low level
language
High level language
• It is a programming language that in comparison
to high level language is more compact,
abstract, easier to use and portable to most
platforms
• They normally abstract away cpu operations like
memory access models and measurement of
scope
• It can easily implement algorithms
• High level language is converted to assembly by
compiler
Low level language
• It does not provide any sort of abstraction from a
computer’s microprocessor
• First generation low level language: It was only
understood by microprocessor; it requires
numerous numeric codes for writing a single
instruction
• Second generation low level language :e.g.
Assembly language. It is not a microprocessor’s
native language.But programmer still need to
understand internal architecture of
microprocessor such as registers and
instructions e.g. cmp edx,3
Why functions?
• It is a way to make programs more
comprehensive
• Each function has a clearly defined
purpose and a clearly defined interface to
other parts of program
• Module: Grouping of a number of functions
together
Structured programming
• Division of a program into functions and
reconstruction in the form of modules is
structured programming
Data
• In procedural language data is given
second class status But in object oriented
programming data is given first class
status
• Global data: The one that is acessible to
all the functions
• Local Data: the one that is accessible only
to its own confined block
Object oriented programming
• Combine data and functions into a single
unit that operate on that data; such a unit
is called an object
• Object functions: Provide only way to
access its data; if you want to read a data
item you only need to access its function;
Contd…
• C++ typically consists of a number of
objects which communicate with each
other through its functions
Properties of object oriented
programming
• Abstraction
• Inheritance
• Encapsulation
• polymorphism
Inheritence
• Each subclass share a common set of
characteristics from its parent class. In
addition to common characteristics they
have their own characteristics as well
• OOP class can be divided into subclasses.
Original class is called parent class and
those that share common characteristics
are called subclass.
Class
• Serve as template of a new data type . It
specifies what data and functions will be
included in objects of that class. Defining
class don’t create ay object . Similar to
integer don’t create any integer variable.
Compilers
• Borland C++
• Turbo C++
Integrated development
environment
• Put all the tools that you need to develop
program into a single unit
Borland C++
• It is used to create program in windows
environment
• It is a special kind of windows program
that acts like a DOS program ; it runs
under windows but acts like a DOS
program