lecture _1_good

Upload: mohammed-al-maaitah

Post on 14-Oct-2015

6 views

Category:

Documents


0 download

DESCRIPTION

c++ and programme

TRANSCRIPT

  • C++ Programming LanguageLecture 1

    Introduction

    ByGhada Al-MashaqbehThe Hashemite UniversityComputer Engineering Department

    The Hashemite University

  • OutlineIntroduction.C++ overview.Computer organization and hardware trends.Evolution of operating systems and types of computing.Programming languages.Basics of a typical C++ environment.

    The Hashemite University

  • IntroductionIn this course you will learn C++ and the legacy C code.It is your first step in the software programming world.It will provide you with the needed tools and background to learn object-oriented programming.

    The Hashemite University

  • What is C++?A powerful programming language that enables you to write instructions (i.e. software) to drive the hardware of the computer (i.e. to perform actions and take decisions).But first, what is computers? What is hardware? And what is software?

    The Hashemite University

  • What is a Computer?ComputerA device capable of performing computations and making logical decisions in a very fast manner.Computer programsSets of instructions that control a computers processing of dataHardwareVarious devices comprising a computerExamples: keyboard, screen, mouse, disks, memory, CD-ROM, and processing unitsSoftwarePrograms that run a computer

    The Hashemite University

  • Computer OrganizationSix logical units in every computer:Input unitObtains information from input devices (keyboard, mouse).Output unit Outputs information (to screen, to printer, to control other devices)Primary Memory unit Rapid access, low capacity, stores input information and programs while they are being executed (active programs and data).Arithmetic and logic unit (ALU) Performs arithmetic calculations and logical decisions.Central processing unit (CPU) Supervises and coordinates the other sections of the computer (called the heart of the computer).Secondary storage unit Cheap, long-term, high-capacity storage, stores inactive programs.

    The Hashemite University

  • Hardware TrendsEvery year or two computers approximately double the following:The amount of memory (primary) they containMemory used to execute programsThe amount of secondary storage they containSecondary storage (such as disk storage) is used to hold programs and data over timeTheir processor speedsThe speed at which computers execute their programsThis development is accompanied with a decrease in prices and computers cost.

    The Hashemite University

  • Evolution of Operating SystemsOperating system (OS) is the intermediary software that lies between the hardware and the computer applications where it enables the interfacing between the user and the computer hardware.Operating systems development:Batch processingSingle user is allowed where it do only one job or task or program at a time while processing data in groups or batches.Operating systems Manage transitions between jobs in more convenient way.Increased throughput : Amount of work computers process.Still single user batch processing.Multiprogramming Many jobs or tasks sharing a computers resources (multitasking facility).TimesharingSpecial case of multiprogramming.Access computer resources via terminals.Perform a small portion of one users job then moves on to service the next user

    The Hashemite University

  • Types of ComputingPersonal computers Economical enough for individualDistributed computing Organizations computing is distributed over networksClient/server computingSharing of information across computer networks between servers (such as file servers, email servers, etc.) and clients (personal computers connected to the network)

    The Hashemite University

  • Programming Languages IThree types of programming languagesMachine languages Strings of numbers giving machine specific instructions.Computers can only understand this language.Example:10100011001001 11111111111111 00000001110100Machine dependent: every machine has its own language.Hard to be understood by humans.Hard to be used in programming.Too slow and tedious.Error prone.

    The Hashemite University

  • Programming Languages IIAssembly languagesEnglish-like abbreviations representing elementary computer operations so it is easier to be understood by humans.Translated or converted into machine language via assemblers.Also, it is slow and hard to be used in programming.Machine dependent.Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY

    The Hashemite University

  • Programming Languages IIIHigh-level languages Similar to everyday English, use mathematical notations.Translated into machine language via compilers (compile the whole program at once).Interpreters are used to execute high level languages without need to compile them into machine language and it execute single line at a time.Compiled programs are faster than the interpreted ones.Fast and easy for programming.Machine independent.Example:grossPay = basePay + overTimePay

    The Hashemite University

  • Programming Languages IVIt is common to classify the computer programming languages into two types:Low level programming languages which includes both the machine and assembly languages.High level languages as in the previous slide.

    The Hashemite University

  • Example of High-level LanguagesOther high-level languagesC and C++.JavaVisual basic 6/.NetC#.NetFORTRAN Used in scientific and engineering applicationsCOBOL Used to manipulate large amounts of dataPascal Used to teach structured programming

    The Hashemite University

  • History of C and C++C++ evolved from CC evolved from two other programming languages: BCPL and B which are used mainly to develop operating systems and compilers.ANSI C: standard of C and C++ANSI (American National Standard Institution ) has cooperated with ISO (International Organization for Standardization) to established worldwide standards for C and C++ programming to make C++ programs portable.C99 is the latest ANSI standard of C/C++C++ spruces up CProvides capabilities for object-oriented programmingObjects are reusable software components that model things in the real worldObject-oriented programs are easy to understand, correct and modify

    The Hashemite University

  • C++ Standard LibraryC++ programsBuilt from pieces called classes and functions.C++ standard libraryProvides rich collections of existing classes and functions for all programmers to use.

    The Hashemite University

  • Basics of a Typical C++ EnvironmentPhases of C++ Programs:Edit (create .h and .cpp files): create the source code or filePreprocessCompile: creates the object codeLink: creates the executable fileLoadExecute

    The Hashemite University

  • Additional NotesCheck the Black Board to get your copy of the lecture.The lecture covers the following sections from the textbook:Fourth edition:Chapter 1: Sections 1.1 1.8, 1.14, 1.15

    The Hashemite University