Вы находитесь на странице: 1из 55

Introduction to computer & programming

MS SADIA EJAZ CS DEPARTMENT


CIIT ATTOCK

Software Categories

Software is categorized into two main categories


System Software Application Software

MS Sadia Ejaz CIIT ATTOCK

System Software

The system software controls the computer. It communicates with computers 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

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

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

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

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

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

Computer Network

A computer network is a group of interconnected computers.

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

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

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

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

Types of Computer Programming Language

There are two types of computer programming languages.


Low-Level languages High- Level Languages

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

Machine Language

In this language, instructions are written in binary from. It is directly understood by the computer. Programs written in this language are machinedependent. It is also known as first generation language.

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

High-Level Language

Language that is close to human languages. It is easier to write and modify.

MS Sadia Ejaz CIIT ATTOCK

Categories of High Level Languages

Procedural Languages Object-Oriented Languages Non-procedural Languages

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

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

Features of Object-Oriented Programming

Objects Classes Real-world Modeling Reusability Information Hiding Encapsulation Polymorphism Multiple ways

MS Sadia Ejaz CIIT ATTOCK

C++

Object-Oriented Language Developed in 1980 at Bell Lab. Improved version of C language. Powerful language.

MS Sadia Ejaz CIIT ATTOCK

History of C++

The C language was developed in late 60s and early 70s, 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

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

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

Difference Between Low-Level & High-Level Languages


High-Level Language High-level language are easy to learn. Low-Level Language Low-level languages are difficult to learn.

Translator is required.

No translator is required.

Programs in high-level languages Programs in low-level languages are slow in execution. are fast in execution.

Programs in high-level languages Programs in low-level languages are easy to modify. are difficult to modify.

MS Sadia Ejaz CIIT ATTOCK

Difference Between Low-Level & High-Level Languages


High-Level Language Low-Level Language

High-level languages are near to human languages.


High-level languages do not provide much facility at hardware level. Deep knowledge of hardware is not required to write programs. These languages are normally used to write application programs.

Low-level languages are far from human languages.


Low-level languages provide facility to write programs at hardware level. Deep knowledge of hardware is required to write programs. These languages are normally used to write hardware programs.

MS Sadia Ejaz CIIT ATTOCK

Natural Programming Language

Fifth generation language Very complex Most of these languages are in experimental phase.

MS Sadia Ejaz CIIT ATTOCK

Types of Codes

Source Code

Written in high-level language


Translated by language processor. Machine code

Object Code

Computer can not understand source code but directly understands object code.

MS Sadia Ejaz CIIT ATTOCK

Difference Between Source Code & Object Code


Source Code
Source code is written in highlevel or assembly language. Source code is easy to understand. Source code is easy to modify. Source code contains fewer statements than object code.

Object Code
Object code is written in machine language through compilers. Object code is difficult to understand. Object code is difficult to modify. Object code contains more statements than source code.

MS Sadia Ejaz CIIT ATTOCK

Language Processor

It is a software that converts high-level language into machine language.

MS Sadia Ejaz CIIT ATTOCK

Types of Language Processor

Complier Interpreter Assembler

MS Sadia Ejaz CIIT ATTOCK

Compiler

It converts source program as a whole into machine code / object program.

Source Program

Compiler

Object Program

MS Sadia Ejaz CIIT ATTOCK

Interpreter

It converts one statement of a program at one time.

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

Difference Between Compiler & Interpreter


Compiler

Interpreter

Compiler will stop translating if Interpreter will execute all the it finds an error and there will be lines before error and will stop at no executable code generated. the line which contains the error. Compiler compile the program as It converts one statement of a whole. 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

Programming Techniques

Structured Programming Object-Oriented Programming Event-Driven Programming Visual Programming

MS Sadia Ejaz CIIT ATTOCK

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

Structured Programming (contd.)

Iterative / Repetitive Structure Loops Function Call Control moves to block of code

MS Sadia Ejaz CIIT ATTOCK

Advantages & Disadvantages of Structured Programming

Advantages

Reusability Easier to code Easier to modify Easier to maintain


Difficult to separate data from functions.

Disadvantage

MS Sadia Ejaz CIIT ATTOCK

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

Event-Driven Programming

Statements are executed in response to an event. For Example: Clicking the mouse button.

MS Sadia Ejaz CIIT ATTOCK

Visual Programming

Graphical user interface

User friendly interface

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

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

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

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

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

C++ Statements

These are the instructions for the computer to perform a task.

MS Sadia Ejaz CIIT ATTOCK

Basic Structure of C++ Program


# include <iostream.h> void main( ) { cout<<Hello World; }
Preprocessor Directive Main function

C++ Statement

MS Sadia Ejaz CIIT ATTOCK

Using cout

The cout object is used to print a message on the screen.

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

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

LAB WORK

MS Sadia Ejaz CIIT ATTOCK

Вам также может понравиться