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

Introduction To Programming 01

This document provides an introduction to programming languages. It discusses types of computer languages including low-level languages like machine language and assembly language, as well as high-level languages. It describes key characteristics of programming languages such as being machine independent and easier for humans to learn and use. The document also discusses programming language translators including assemblers, compilers, and interpreters which translate languages into machine-readable code.

Uploaded by

Zarrar Sadat
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Introduction To Programming 01

This document provides an introduction to programming languages. It discusses types of computer languages including low-level languages like machine language and assembly language, as well as high-level languages. It describes key characteristics of programming languages such as being machine independent and easier for humans to learn and use. The document also discusses programming language translators including assemblers, compilers, and interpreters which translate languages into machine-readable code.

Uploaded by

Zarrar Sadat
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Faculty of Computer

Science
Subject: Introduction to Programming-C++
Lecturer: Mr. Fakhruddin
Noori
Introduction to programming

Chapter 01
Introduction to programming Chapter 01

Principles of
Learning outcomes:
Marketing
Types of Computer Languages
Comparison between Low-Level and High-Level Languages
Programming Language Characteristics
Understanding of different language translators
Program in C/C++
C/C++ programs execution
Introduction to programming Chapter 01

General Introduction
Principles
 You know that computer is one ofadvanced and fast growing technologies
of the most
in the world. Marketing
It is an electronic device that can solves different problems, processes
data, stores & retrieves data and performs calculations faster than
humans.

 Different computer languages are used for communication between users and
computers. It defines the rules under which programs are written to make use of
computers.
 Hundreds of computer languages are in use today.
Introduction to programming Chapter 01

What is Language?
Principles of between people.
 Language is a source of communication
Marketing
 It is medium of Expression

 What is the computer language?

 To establish a communication between user and computer .

 In general, there are two classes of languages


 Natural languages
 Programming Languages
Introduction to programming Chapter 01

What is Language?
Natural languages Principles of
These are the languages through which the human beings communicate with each other. For example: Dari,
English, Urdu, French, Pashto etc.
Marketing

Programming languages
These are the languages through which the human beings communicate with the computer. These are the
most widely used mediums between the user and the computer. Examples are C, C++, COBOL, PASCAL,
BASIC, FORTRAN etc.

The programming languages are classified into two types:


1) Low level languages.
2) High level languages
Introduction to programming Chapter 01

Low-level Language
 Principles of
It consists of two types of languages
1. Machine language Marketing
 Machine Language was the first language used for computers as a source of
communication.
 This is the only language which is directly understandable by the machine (computer)
and needs no translation programs (compiler, Assembler, Interpreter).
 Machine language is the language of binary digits 0’s and 1’s (“0” means “OFF” and
“1” means “ON) that is why it is also called as binary language.
 It is very difficult to write programs using 0’s and 1’s i.e. in machine language. Thus
machine language is totally machine dependent and is efficient for computers and
inefficient for programmers.
Introduction to programming Chapter 01

Low-level Language
Principles
Points to remember (Machine of
Language)
Marketing
 The first language that was invented.
 It is machine dependent.
 It is also called binary language.
 It is the most complicated and hard language.
 A program created in machine language cannot be run on any other
computer
 Machine language depends on electric pulses (i.e. on/off).
Introduction to programming Chapter 01

Low-level Language
2. ASSEMBLY LANGUAGE Principles of
 Marketing
The computer professionals developed one step higher language than the machine
language which is called Assembly language.
 The binary codes of machine language (0’s and 1’s) were replaced by some special codes
called mnemonics.
 The programs in Assembly language are written using these mnemonic codes as: ADD for
addition, SUB for subtraction MUL for multiplication.
 These mnemonics are understandable by the human but not understandable by the
machine. To make it understandable for the machine, a program called assembler is
developed its function is to translate a program written in assembly language into
machine language
Introduction to programming Chapter 01

High-level Language
Principles of
 These languages are fairly machine independent and English like.
Marketing
 The programmer can understand more easily and enable the programmer to
write instructions easily using English words and familiar mathematical
symbols such as if else, for, goto, +,- etc.

 A program written in high-level language is translated into machine


understandable form with the help of Translation programs i.e. interpreter or
compiler.
Introduction to programming Chapter 01

High-level Language
Principles
Points to remember (High-level of
Language)
Marketing
 It is English like language.
 It is much easy to learn.
 High level program is just like giving instruction to a person in daily
life.
 High level program need preprocessor to convert the program into machine

codes.
 Different types of programming languages are FORTRAN, Pascal, C and

C++ etc.
Introduction to programming Chapter 01

Programming Language Characteristics


Principles of
 Programming languages have some characteristics that describe how they
Marketing
work and provide information about the types of computing tasks for
which they are appropriate.

 When you need to select a language to use for a program, it is useful to


understand some of the general characteristics of programming languages
and the advantages or disadvantages of these characteristics are given as
Introduction to programming Chapter 01

High Level Language Characteristics


Principles of
 Machine Independence
Marketing
 High-Level languages are machine independent.
 This is a very valuable advantage because it means that a program written
in a high-level language can be run on many different types of computers
with very little or practically no effort.

 Easy to learn and use:


 These languages are very similar to the languages normally used by us
in our day-to-day life. Hence they are easy to learn and use.
Introduction to programming Chapter 01

High Level Language Characteristics


 Fewer errors Principles of
 In case of high-level Marketing
languages, since the programmer need not write all the small steps
carried out by the computer, he is much less likely to make an error.
 The computer takes care of all the little details, and will not introduce any error of its own
unless something breaks down.
 Furthermore, compilers are so designed that they automatically catch and point out the errors
made by the programmer.
 Hence errors, if any, can be easily located and corrected by the programmer.

 Lower program preparation cost


 Writing program in high-level languages requires less time and effort which ultimately leads
to lower program preparation cost.
Introduction to programming Chapter 01

Programming Language Translators


Principles of
 Translators are programs, which translate programs written in any high or assembly
Marketing
language into machine language (1’s and 0’s).

Program code Language Machine code


translator

 There are three types of language translators


 Assembler
 Compiler
 Interpreter
Introduction to programming Chapter 01

Programming Language Translators


 Assembler Principles of
 Marketing
The software that translates and assembly code into the computer’s machine code is called
assembler.

 A program written by a programmer in assembly language is called source program.

 After this source code has been converted into object code

Source Program Assembler Machine code


Introduction to programming Chapter 01

Programming Language Translators


 Compiler Principles of

Marketing
A compiler is a computer software that translates a whole program, called the source code
at once into machine code (object code).

 Interpreter
 An interpreter in another type of translator used for translating a language program into
machine code
 It takes one statement of program and translates it into a machine instruction which is
immediately executed by computer

Source Program Compiler/Interpreter Machine code


Introduction to programming Chapter 01

What is Program?
Principles of
 Is a set of instructions, or a Marketing
set of sequential instructions which are given to
computer to solve a specific problem.
 Programs are written in computer languages like BASIC, PASCAL,C etc.

--------------
--------------
----C/C++--
---program- Run on computer
--------------
--------------
---------------
Introduction to programming Chapter 01

What is Program?
Principles of
Different types of Programs
Marketing
 Generally there are THREE types of Programs that’s are created in

a programming Languages:

 Source Programs
 Object Programs
 Executable Programs
Introduction to programming Chapter 01

Source Program & Object Program


Principles of
 Source Program:-
Marketing
 The program which is written by the programmer in a computer language is called source
program.
 A Program that is created by programmer in a high level (C/C++) language with the extension
of cpp/c.
 Object program:-
 The program which is converted into machine understandable code by the compiler is called
object program.
 A program that is created by the language processor in the form of codes is called Object
program.
 A program that is converted in to object language (Machine) is called object program
Introduction to programming Chapter 01

History of C language
Principles of
 The C programming language was designed by Dennies Ritchie in the early 1970’s at
Bell Laboratories. Marketing
 It was first used system implementation language for the nascent Unix operating system.
 The main reason to devised C was to overcome the limitations of B. 
 It was Derived from the type-less language BCPL ((Basic Combined Programming
Language).
 C was the evolution of B and BCPL by incorporating type checking. It was originally
intended for use in writing compilers for other languages

CPL BCPL B C C++


Introduction to programming Chapter 01

History of C++ language


Principles of
 C++ was devised by Bjarne Stroustrup in 1983 at Bell Laboratories.
Marketing
 It is an extension of C by adding some enhancements to C language.

 The new features added to language are templates, namespaces, exception handling and
use of standard library.
Introduction to programming Chapter 01

Thank You
For Your Patience

You might also like