Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to computer programming

Similar presentations


Presentation on theme: "Introduction to computer programming"— Presentation transcript:

1 Introduction to computer programming
MS SADIA EJAZ CS DEPARTMENT CIIT ATTOCK

2 MS Sadia Ejaz CIIT ATTOCK
Software Categories Software is categorized into two main categories System Software Application Software MS Sadia Ejaz CIIT ATTOCK

3 MS Sadia Ejaz CIIT ATTOCK
System Software The system software controls the computer. It communicates with computer’s hardware (key board, mouse, modem, sound card etc) and controls different aspects of operations. Sub categories of system software are: Operating system Device drivers Utilities MS Sadia Ejaz CIIT ATTOCK

4 MS Sadia Ejaz CIIT ATTOCK
Operating System “Operating system is the software responsible for controlling the allocation and usage of hardware resources such as memory, central processing unit (CPU) time, disk space, and peripheral devices. The operating system is the foundation on which applications, such as word processing and spreadsheet programs, are built. (Microsoft)” MS Sadia Ejaz CIIT ATTOCK

5 Device drivers/ Utility Software
The device driver software is used to communicate between the devices and the computer. Utility software is a program that performs a very specific task, usually related to managing system resources. MS Sadia Ejaz CIIT ATTOCK

6 MS Sadia Ejaz CIIT ATTOCK
Application software A program or group of programs designed for end users. For example a program for Accounting, Payroll, Inventory Control System, and guided system for planes. MS Sadia Ejaz CIIT ATTOCK

7 Database Management System
A DBMS is a complex set of software programs that controls the organization, storage, management, and retrieval of data in a database. It is a set of prewritten programs that are used to store, update and retrieve a Database. MS Sadia Ejaz CIIT ATTOCK 7

8 MS Sadia Ejaz CIIT ATTOCK
Computer Viruses A computer virus is a program which reproduces itself. It may attach to other programs, it may create copies of itself (as in companion viruses). It may damage or corrupt data, change data, or degrade the performance of your system by utilizing resources such as memory or disk space. MS Sadia Ejaz CIIT ATTOCK 8

9 MS Sadia Ejaz CIIT ATTOCK
Computer Network A computer network is a group of interconnected computers. MS Sadia Ejaz CIIT ATTOCK 9

10 MS Sadia Ejaz CIIT ATTOCK
What is programming Definition: "A program is a precise sequence of steps to solve a particular problem.” It means that when we say that we have a program, it actually mean that we know about a complete set activities to be performed in a particular order. The purpose of these activities is to solve a given problem. MS Sadia Ejaz CIIT ATTOCK

11 MS Sadia Ejaz CIIT ATTOCK
Language? Way of communication When we communicate one another then we need a specific language to express our words Example English Urdu Arabic etc MS Sadia Ejaz CIIT ATTOCK

12 MS Sadia Ejaz CIIT ATTOCK
Computer Programming Computer programming is defined as telling a computer what to do through a special set of instructions which are then interpreted by the computer to perform some task(s). These instructions can be specified in one or more programming languages including (but not limited to) Java, PHP, C, and C++. MS Sadia Ejaz CIIT ATTOCK

13 MS Sadia Ejaz CIIT ATTOCK
Programming Language A set of words, symbols and codes used to write a programs is called program language. Different programming languages are available for writing different types of programs. MS Sadia Ejaz CIIT ATTOCK

14 Types of Computer Programming Language
There are two types of computer programming languages. Low-Level languages High- Level Languages MS Sadia Ejaz CIIT ATTOCK

15 MS Sadia Ejaz CIIT ATTOCK
Low-Level Languages These are near to computer hardware and far from human language. Two low-level languages. Machine Language Assembly Language MS Sadia Ejaz CIIT ATTOCK

16 MS Sadia Ejaz CIIT ATTOCK
Machine Language In this language, instructions are written in binary from. It is directly understood by the computer. Programs written in this language are machine-dependent. It is also known as first generation language. MS Sadia Ejaz CIIT ATTOCK

17 MS Sadia Ejaz CIIT ATTOCK
Assembly Language In this language, symbols are used. Symbols are called mnemonics. Symbolic Language It is mostly used for writing system software. Second generation language. MS Sadia Ejaz CIIT ATTOCK

18 MS Sadia Ejaz CIIT ATTOCK
High-Level Language Language that is close to human languages. It is easier to write and modify. MS Sadia Ejaz CIIT ATTOCK

19 Categories of High Level Languages
Procedural Languages Object-Oriented Languages Non-procedural Languages MS Sadia Ejaz CIIT ATTOCK

20 MS Sadia Ejaz CIIT ATTOCK
Procedural Languages Third generation languages In these languages, program is a predefined set of instructions. Popular procedural languages . FORTRAN  FORmula TRANslation BASIC  Beginner All Purpose Symbolic Instruction Code COBOL  Common Business Oriented Language PASCAL C  Middle-level language Application Software as well as System Software MS Sadia Ejaz CIIT ATTOCK

21 Object- Oriented Languages
Programs are written on the basis of objects. Object  Collection of data and functions Easier to learn and modify. C++ and Java MS Sadia Ejaz CIIT ATTOCK

22 Features of Object-Oriented Programming
Objects Classes Real-world Modeling Reusability Information Hiding  Encapsulation Polymorphism  Multiple ways MS Sadia Ejaz CIIT ATTOCK

23 MS Sadia Ejaz CIIT ATTOCK
Object-Oriented Language Developed in 1980 at Bell Lab. Improved version of C language. Powerful language. MS Sadia Ejaz CIIT ATTOCK

24 MS Sadia Ejaz CIIT ATTOCK
History of C++ The C language was developed in late 60’s and early 70’s, in Bell Laboratories. In those days BCPL and B languages were developed there. The BCPL language was developed in 1967 by Martin Richards as a language for writing operating systems software and compilers. In 1970 Ken Thompson used B language to create early versions of the UNIX operating system at Bell Laboratories. Dennis Ritchie developed a general purpose language, called C language, by using different features of BCPL and B languages. In the early 1980's, also at Bell Laboratories, another programming language was created which was based upon the C language.  This new language was developed by Bjarne Stroustrup and was called C++ MS Sadia Ejaz CIIT ATTOCK

25 Difference b/w c and c++
When he designed C++, he added OOP (Object Oriented Programming) features to C without significantly changing the C component.  Thus C++ is a "relative" (called a superset) of C, meaning that any valid C program is also a valid C++ program. MS Sadia Ejaz CIIT ATTOCK

26 Non-Procedural Languages
Fourth-generation language Need to tell computer “what to do” not “how to do”. It is used in database application and report generation. Important Non-procedural languages. SQL  Structured Query Language RPG  Report Program Generator MS Sadia Ejaz CIIT ATTOCK

27 Difference Between Low-Level & High-Level Languages
Low-Level Language High-level language are easy to learn. Low-level languages are difficult to learn. Translator is required. No translator is required. Programs in high-level languages are slow in execution. Programs in low-level languages are fast in execution. Programs in high-level languages are easy to modify. Programs in low-level languages are difficult to modify. MS Sadia Ejaz CIIT ATTOCK

28 Difference Between Low-Level & High-Level Languages
Low-Level Language High-level languages are near to human languages. Low-level languages are far from human languages. High-level languages do not provide much facility at hardware level. Low-level languages provide facility to write programs at hardware level. Deep knowledge of hardware is not required to write programs. Deep knowledge of hardware is required to write programs. These languages are normally used to write application programs. These languages are normally used to write hardware programs. MS Sadia Ejaz CIIT ATTOCK

29 Natural Programming Language
Fifth generation language Very complex Most of these languages are in experimental phase. MS Sadia Ejaz CIIT ATTOCK

30 MS Sadia Ejaz CIIT ATTOCK
Types of Codes Source Code Written in high-level language Object Code Translated by language processor. Machine code Computer can not understand source code but directly understands object code. MS Sadia Ejaz CIIT ATTOCK

31 Difference Between Source Code & Object Code
Source code is written in high-level or assembly language. Object code is written in machine language through compilers. Source code is easy to understand. Object code is difficult to understand. Source code is easy to modify. Object code is difficult to modify. Source code contains fewer statements than object code. Object code contains more statements than source code. MS Sadia Ejaz CIIT ATTOCK

32 MS Sadia Ejaz CIIT ATTOCK
Language Processor It is a software that converts high-level language into machine language. MS Sadia Ejaz CIIT ATTOCK

33 Types of Language Processor
Complier Interpreter Assembler MS Sadia Ejaz CIIT ATTOCK

34 MS Sadia Ejaz CIIT ATTOCK
Compiler It converts source program as a whole into machine code / object program. Compiler Source Program Object Program MS Sadia Ejaz CIIT ATTOCK

35 MS Sadia Ejaz CIIT ATTOCK
Interpreter It converts one statement of a program at one time. MS Sadia Ejaz CIIT ATTOCK

36 MS Sadia Ejaz CIIT ATTOCK
Assembler It translated the instruction of a assembly language into machine language. Assembly Language Program Assembler Object Program MS Sadia Ejaz CIIT ATTOCK

37 Difference Between Compiler & Interpreter
Compiler will stop translating if it finds an error and there will be no executable code generated. Interpreter will execute all the lines before error and will stop at the line which contains the error. Compiler compile the program as whole. It converts one statement of a program at one time. Compiler generate object file. Interpreter generates no object file. Compiler translation is fast. Interpreter translation is slow. MS Sadia Ejaz CIIT ATTOCK

38 Programming Techniques
Structured Programming Object-Oriented Programming Event-Driven Programming Visual Programming MS Sadia Ejaz CIIT ATTOCK

39 Structured Programming
A program is divided in small units called modules or sub-programs. Sequential Structure Control flows in logical sequence. Conditional/ Selective structure Selection on basis of condition MS Sadia Ejaz CIIT ATTOCK

40 Structured Programming (contd.)
Iterative / Repetitive Structure Loops Function Call Control moves to block of code MS Sadia Ejaz CIIT ATTOCK

41 Advantages & Disadvantages of Structured Programming
Reusability Easier to code Easier to modify Easier to maintain Disadvantage Difficult to separate data from functions. MS Sadia Ejaz CIIT ATTOCK

42 Object-Oriented Programming
Programs are written on the basis of objects. Object Collection of data and function Easier to learn and modify Examples: C ++ Java MS Sadia Ejaz CIIT ATTOCK

43 Event-Driven Programming
Statements are executed in response to an event. For Example: Clicking the mouse button. MS Sadia Ejaz CIIT ATTOCK

44 MS Sadia Ejaz CIIT ATTOCK
Visual Programming Graphical user interface User friendly interface MS Sadia Ejaz CIIT ATTOCK

45 MS Sadia Ejaz CIIT ATTOCK
Features of C++ It is very convenient language. It is a well-structured language. It is case sensitive language. It provides machine independent. It is an object oriented language. In C++. A program can be divided into small modules. MS Sadia Ejaz CIIT ATTOCK

46 Basic Structure of C++ Program
The format of writing program in C++is known as its structure. It consists of following parts. Pre-processor directive Main( ) function Program body  C++ statements MS Sadia Ejaz CIIT ATTOCK

47 Pre-processor Directive
It is an instruction given to the compiler before the execution of actual program. Include preprocessor directive is used in C++ to include header files in the program. # include <iostream.h> Preprocessor Directive Header files MS Sadia Ejaz CIIT ATTOCK

48 MS Sadia Ejaz CIIT ATTOCK
Header Files It is a collection of standard library functions to perform different tasks. There are many header files for different purposes. It must be included in the program before calling any of its function. MS Sadia Ejaz CIIT ATTOCK

49 MS Sadia Ejaz CIIT ATTOCK
Main ( ) Function It is the starting point of a C++ program. C++ statements are written in the body of the main () function. void main( ) { Body of the main function } MS Sadia Ejaz CIIT ATTOCK

50 MS Sadia Ejaz CIIT ATTOCK
C++ Statements These are the instructions for the computer to perform a task. MS Sadia Ejaz CIIT ATTOCK

51 Basic Structure of C++ Program
# include <iostream.h> void main( ) { cout<<“Hello World”; } Preprocessor Directive Main function C++ Statement MS Sadia Ejaz CIIT ATTOCK

52 MS Sadia Ejaz CIIT ATTOCK
Using ‘cout’ The cout object is used to print a message on the screen. MS Sadia Ejaz CIIT ATTOCK

53 MS Sadia Ejaz CIIT ATTOCK
Purpose of C++ Stroustrup states that the purpose of C++ is to make writing good programs easier and more pleasant for the individual MS Sadia Ejaz CIIT ATTOCK

54 MS Sadia Ejaz CIIT ATTOCK
versions of the C++ There are several versions of the C++ language, of which Visual C++ is only one.  Other dialects include Borland C++, Turbo C++, and Code Warrior (Mac).  MS Sadia Ejaz CIIT ATTOCK

55 MS Sadia Ejaz CIIT ATTOCK
LAB WORK MS Sadia Ejaz CIIT ATTOCK


Download ppt "Introduction to computer programming"

Similar presentations


Ads by Google