Csc240 lecture 1

Preview:

Citation preview

CSC240INTRODUCTION TO PROGRAMMING – I

Mr. Dilawar

Lecturer,Department of Computer Science,

Jahan UniversityKabul, Afghanistan.

Course Objectives• After successfully completing this course, you will be able to:

• What is a computer system and how it works.• Flow charts and Algorithms.• Computer programming concepts and their implementation in C++ language.

Course Outline• Introduction to Computer and Programming Languages.

• Elements of C++ Language.

• Control Structures.

• Working and Understanding Arrays.

• Working with Structures, Union and Enumeration.

Text Books to Follow• Dietal & Dietal, C/C++: How to Program 7th Edition.

• Programming with C++ by CM Aslam & TA Qureshi (Aikmen Series).

• Object oriented programming using C++ by IT Series.

Lecture Outline• Introduction to computers and computer organization

• Personal, Distributed and Client/Server Computing

• Programming languages

• Components of programming languages

• Programming techniques

Introduction to Computer• An electronic machine that can perform computations and logical

decisions at a speed of millions and even billions of times faster than human being.

• Processes data under control sets of instructions called program.

• A program is a set of instructions that is used to perform a specific task.

• Programs are written by programmer.

• Programming Languages are the source through which a programmer writes and develops computer programs.

Introduction to Computer• Computers are comprised of two parts:

• Hardware- • Software

HardwareElectronics circuit boards

that provide functionality of the system

SoftwareProgram consists

of sets of instructionsthat control the system

Computer Organization

Control Unit

Datapath

Arithmetic Logic Unit

(ALU)

Registers

Processor (CPU)

Computer Organization• Input Unit

• Receiving section of the computer.• Gets data from various devices and places.• Data is entered into computer with the help of mouse & keyboard.• Data can also be entered in the form of voice and images via scanner and

microphone.

Computer Organization• Output Unit

• Shaping section of the computer.• Takes information from CPU and places it on various output devices.• Information can be viewed either on screens or printed papers.

Computer Organization• Memory Unit

• Short time warehouse section of computer.• It keeps the data that has been entered so that it can be available for

processing.• It also keeps the processed data so that information can be placed on output

devices by output unit.

Computer Organization• Arithmetic & Logic Unit

• Manufacturing section of computer.• It is responsible for calculations and logical operations.• Calculation involves addition, subtraction, multiplication and division.

Computer Organization• Control Unit

• Administrative section of computer.• It supervises the operations of the other sections.• It control and allocates jobs for all other units.• Many of today’s computers have multiple CPUs and, hence, can perform

many operations simultaneously – multicore processors.• Dual-core processors – Two CPU’s

• Quad-core processors – Four CPU’s

Computer Organization• Registers

• Storage location in CPU, used to hold data or a memory address during the execution of an instruction.

Computer Organization• Secondary Unit

• Long time warehouse section of computer• Program and data that are not actively used by the other units are normally

placed on secondary storage time.• It stores the data permanently for future time.• Non-Volatile Memory

Personal, Distributed and Client/Server Computing• Using desktop and laptop computers for personal use – Personal

computing.

• In 1977, Apple computer popularized Personal computing.

• In 1981, IBM the world’s largest computer vender, introduced the IBM Personal Computer.

• Stand-alone – transported disks back and forth between them – Sneakernet.

Personal, Distributed and Client/Server Computing• Machines could be linked together in computer networks, over

telephone lines in LANs that led to the phenomenon of distributed computing.

• Distributed computing is a model in which components of a software system are shared among multiple computers to improve efficiency and performance.

Personal, Distributed and Client/Server Computing• In Client/Server computing:

• Servers provides services such as file servers, database servers, web servers and etc…

• Client computers uses the services provided by the server.

Programming Languages• A programming language is used to write computer programs.

• It is an artificial language designed to communicate instructions to a machine.

• Some of them are directly understandable by computer and some of them are needed to be converted first.

Programming Languages• Computer languages are divided into three broad types:

• Machine Language• Assembly Language• High-Level Language

Programming Languages• Machine Languages

• A computer understands machine language.• Machine language is also called binary language.• It is consist of two digits that instructs computers to perform their operations.• They are machine-dependent.• No translation is required – directly understandable by computer.• They are hard to learn and understand.

Programming Languages

Programming Languages• Assembly Language

• A language in which instead of binary codes we use English like abbreviations (mnemonics) to represent the operations for the computer.

• A language that uses symbolic names to represent operations, registers and memory locations.

• It uses a translator called Assembler.

Programming Languages

Programming Languages• High-Level Language

• A language in which the instructions are written in the form of everyday English and contain commonly used mathematical notations.

• Compiler and Interpreter are used to covert the high-level code to machine code.

Programming Languages

Programming Languages

Hierarchy of Languages

Language Representations

Components of Programming Languages• Syntax

• It is about the structure of the grammar of the language.• In programming language, the rules and regulations for writing code are

called the syntax.• A syntax can be used to construct a valid sentence/statement.

Components of Programming Languages• Semantic

• It describes the meaning of the sentence.• It describes that whether the sentence is correct or not. If so, what does the

sentence mean?

Categories of Programming Languages• Major programming languages falls in the category of:

• Structured Programming Languages• Modular Programming Languages• Object-Oriented Programming Languages

Categories of Programming Languages• Structured Programming Languages

• Languages in which the program is divided into smaller components – functions.

• The structured programming contains three major concepts that are:• Top-down Design / Divide and Conquer

• Code Reusability

• Information Hiding

Categories of Programming Languages• Modular Programming Languages

• Languages in which the program is broken into individual components called modules that can be programmed and tested independently.

Categories of Programming Languages• Object-Oriented Programming Languages

• Languages in which object technology is supported.• It allows the pieces of software to be reused and interchanged between

programs.• The major concepts used in OOP are:

• Data Abstraction – Describes user defined datatypes.

• Encapsulation – Information Hiding

• Inheritance – Describes the reusability of a class.

• Polymorphism – Describes the ability to produce different results based on the object that is sent to.

Summery• Introduction to computers and computer organization

• Personal, distributed, and client/server computing

• Programming languages

• Components of programming languages

• Categories of programming languages

Thank YouFor your Patience

Recommended