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

5th Week History and Def C++ Language1

Uploaded by

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

5th Week History and Def C++ Language1

Uploaded by

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

Fundamental of Algorithm and programming

++using C

Lecturer: Sarullah Zahidi


:Email Address
[email protected]
2
Course Details
Lectures
Assignments
Presentation
Lab Work (Practical)

3
LANGUAGE?
Language is a source of communication between people.
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

4
Natural languages
 These are the languages through which the human beings
communicate with each other.
 For example: English, Farsi, Urdu, French, Pashto etc.

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

5
1) Low-Level Language
It consists of two types of languages

Machine language
 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.

6
Main Points of Machine language
The first language that was invented.
It is machine dependant.
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).

7

ASSEMBLY LANGUAGE
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

8
Main points of Assembly Language
it is one step easy then machine language.
It is also called symbolic language (abbreviation are used).
It is machine dependent.
Slow and tedious language.
Special words are used as symbols called MNEMONICS.
A program created on one computer cannot run on another type
of computer.

9
2) High Level Language
These languages are fairly
machine independent and English like.

 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, go to, +,- 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.

10
Main Points of High Level Language
It is English oriented 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

11
The high level languages are of two types:
• Procedural languages/Structured languages.
• OOP (Object Oriented Programming) languages

A Procedural language is that in which each statement tells the computer to do


something. Get some input and process the input and provide the output to the
user , in simple words a program in a procedural language is a list of instructions
that’s created by a user or programmer

OOP
In this language different objects are created from each other and then used in
different functions

12
Programming Language
Characteristics
 Programming languages have some characteristics that describe how
they
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

13
Characteristics of High Level languages

The general characteristics of ‘High Level Languages’ are as follows


Machine Independence
 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.

14
Fewer errors
 In case of high-level 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 diagnostic 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.

15
Language Translator
Translators are system programs, which translate programs written in any high or
assembly language into machine language (1’s and 0’s).

Program code Language Machine code


translator

There are three types of language processors or translators



Assembler

Compiler

Interpreter

16
Language Translators
Assembler

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

17
Language Translators
Complier

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 is 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


18
PROGRAM

 Is a set of instructions, or a 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-------
---program- Run on computer
--------------
--------------
---------------
19
Different types of Programs
Generally there are THREE types of Programs that’s are
created in a programming Languages
Source Programs
Object Programs
Executable Programs

20
Source & Object Programs
Source Program:-The program which is written by the user/programmer in a
computer language is called source program.
A Program that is created by user 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

21
Executable Program
A program that is created by language processor to show or
provide the output of a source program.
A program that is directly run or executes to provide results of the
input.
A Program (software) that’s satisfy the user requirements or
provide the solution of the user problem
Executable program:-When source and object program are linked that’s
create a new executable program is called exe program.

22
First.Cpp

-------------- C++ Files


--------------
-Source--
---program-
--------------
First.Obj
--------------
---------------
--------------
After --------------
Compilation -Object--
---Code----
--------------
--------------
--------------- First.Exe
After --------------
Linking --------------
-Executable--
---Code-
--------------
--------------
23
---------------
The History of C Language
By 1960 a lot of computer languages came into existence, almost each for a specific purpose.
For example C was being used for Commercial Applications, FORTRAN for Engineering and Scientific Applications.
But people wanted a language, which can program all possible applications.
An international committee came out with a language ALGOL 60 but it was too general.
To reduce this generality CPL (Combined Programming Language) was developed at the Cambridge University.
However CPL turned out to be so big that it was hard to learn and difficult to implement.
BCPL (Basic Combined Programming Language) developed by Martin Richard at Cambridge University to solve the problem
but it was too less powerful. Around this time a language B was written by Ken Thomson at AT & T’s Bell Labs as a further
simplification of CPL.
Ritchie inherited the features of B and BCPL added some of its own and developed C language in 1970.
After the development of C, Ritchie and Ken Thompson, who originally wrote the UNIX operating system in Assembly
language, decided to write UNIX using the C language.

ALGOl60 CPL BCPL B C

24
History in brief
C++ developed by Bajarne stroustrup in 1980 at
Bell laboratories New jursey USA
The first name was c with classes but later on in
1983 a new name was given C++
C++ is an extension to C language
It has similar syntax as C language
But it has the feature of OOP

25
‫‪Questions‬‬

‫‪You can ask your question‬‬


‫‪Thought of Day‬‬

‫مشکالت انسانهای بزرگ را‬


‫متعالی و انسانهای کوچک را‬
‫‪.‬متالشی میسازد‬

‫‪26‬‬

You might also like