1 programming in c. 2 the abacus the abacus, a simple counting aid, may have been invented in...

Click here to load reader

Upload: jennifer-stevenson

Post on 31-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Microsoft Visual Basic 2008: Reloaded 3e

Programming in CChapter 1-2Introduction to C

##1V2111 Ch 01-021/9/2012 1:44 PMThe AbacusThe abacus, a simple counting aid, may have been invented in Babylonia (now Iraq) in the fourth century B.C.

#2One of the first examples of a computer is the abacus which aided in counting and was invented 400 years B.C.. It was manually controlled.V2111 Ch 01-021/9/2012 1:44 PMJacquard Loom

#3The first example of a computer following instructions may have been in the Jacquard Loom which wove fabric based on holes punched into a sheet of paper.V2111 Ch 01-021/9/2012 1:44 PMBabbage Difference Engine, reconstructed by the British Government in 1991.

#4More closely related to todays computers is the Analytical Engine:A mechanical computer that can solve any mathematical problem.It includes these features crucial to future computers:An input device (punch cards)A storage facility to hold numbers for processingA processor or number calculatorA control unit to direct tasks to be performedAn output device.V2111 Ch 01-021/9/2012 1:44 PMThe ENIAC

VacuumTube#5The ENIAC was the worlds first large-scale, general purpose electronic computer.It used 18,000 vacuum tubes, occupied a 30 by 50 ft room, and was used for ballistics, weather prediction, and for atomic energy calculations.To control or program, hundreds of wires and thousands of switches had to be set by hand.

V2111 Ch 01-021/9/2012 1:44 PMThe size of a cell phone built with Vacuum Tubes

#6If you built a cell phone with vacuum tubes, you would need a large flat-bed truck to carry it.V2111 Ch 01-021/9/2012 1:44 PMThe IBM 360

#7Developed in 1964, the IBM 360 was the first computer to use integrated circuits.The 360 became the basic model for other mainframes produced by IBM and other companies.It was priced up to a million dollars and by 1968 IBM had sold 14,000.V2111 Ch 01-021/9/2012 1:44 PMThe PDP-8

#8The first minicomputer was produced by Digital Equipment Co. (DEC) in 1965.It cost $5,000 and 50,000 were sold.V2111 Ch 01-021/9/2012 1:44 PMThe MicroprocessorA computer chip that contains on it the entire CPUMass produced at a very low priceComputers become smaller and cheaper Intel 4004 the first computer on a chip, more powerful than the original ENIAC.Intel 8088 used in IBM PC

#9In 1975 the first microcomputer, the Altair 8800 was introduced. The BASIC translator used by the Altair was developed by Bill Gates who later formed Microsoft.In 1977 Steve Jobs and Steve Wozniak begin producing Apple computers in a garage.In 1978 the first spreadsheet for Apple is introduced.In 1981 IBM introduces the IBM Personal Computer which uses the MS-DOS operating system from Microsoft. By 1982, 835,000 IBM PCs had been sold.V2111 Ch 01-021/9/2012 1:44 PMFamous Quotes about ComputersI think there is a world market for maybe five computers. Thomas Watson, chairman of IBM, 1943There is no reason anyone in the right state of mind will want a computer in their home. Ken Olson, President of Digital Equipment Corp, 1977.

#10There have been some very incorrect predictions by some very smart people within the computer industry.For example, Thomas Watson, then chairman of IBM, said I think there is a world market for maybe five computers. Then there was Ken Olson, then President of Digital Equipment, who said There is no reason anyone in the right state of mind will want a computer in their home.V2111 Ch 01-021/9/2012 1:44 PMHardwareHardware the physical devices that make up a computer (often referred to as the computer system)

#A computer system is made up of hardware and software. The part that you can physically touch is the hardware.11V2111 Ch 01-021/9/2012 1:44 PMHardware CoreCPU (Central Processing Unit)CPU (machine) cycle retrieve, decode, and execute instruction, then return result to RAM if necessaryCPU speed measured in gigahertz (GHz)GHz number of billions of CPU cycles per secondRAM (Random Access Memory)Also called Memory, Main Memory, or Primary StorageMeasured in gigabytes (GB, billions of bytes) todayByte CharacterRAM is volatileTemporary storage for instructions and data

#The core of a computer consists of the Central Processing Unit and Random Access Memory. A CPU cycle retrieves an instruction from memory, decodes and executes it, and then may place results back in RAM. Microcomputer speeds today are measured in gigahertz or billions of CPU cycles per second.

For an instruction to be executed, it must be in RAM which today is measured in gigabytes or billions of characters. RAM is volatile so when a computer is turned off, the instructions and data in memory are lost.12V2111 Ch 01-021/9/2012 1:44 PMCapacity of Secondary Storage DevicesKilobyte (KB or K) about 1 thousand bytesMegabyte (MB or M or Meg) about 1 million bytesGigabyte (GB or Gig) about 1 billion bytesTerabyte (TB) about 1 trillion bytes

#Since RAM is volatile, instructions and data must also be stored on non-volatile devices such as hard disks or USB drives. Capacity is measured in KB, MB, GB, or TB.13V2111 Ch 01-021/9/2012 1:44 PMSoftwarePrograms instructions that tell the computer what to doCategoriesApplication software - enables you to solve specific problems or perform specific tasks.System software - handles tasks specific to technology management and coordinates the interaction of all technology devicesUtility software - provides additional functionality to your operating system software

#The instructions that tell the computer what to do are called programs or software. There are three main categories. Applications software is really why you by a computer. It is programs that instruct the computer to perform the tasks that you want the computer to perform such as word processing or accounting. To control the hardware system in the process of running the application programs, you use system software which may be enhanced by different types of utilities which can be classified as system software.14V2111 Ch 01-021/9/2012 1:44 PMSystem SoftwareOperating SystemUNIX / LinuxWindowsMAC OSPalm OSAndroidLanguage TranslatorsC, C++, Basic, Java, Device Drivers

#The main program that controls the hardware is the operating system which might be Unix, Windows, Mac OS, Palm OS, Android or many others. Language translators convert programming languages to the language that a machine understands. Device drivers are an interface between the OS and attached hardware devices.15V2111 Ch 01-021/9/2012 1:44 PMC Programming LanguageDeveloped at AT&T Bell Labs in early 1970sUnix also developed at Bell LabsAll but core of Unix is in CStandardized by American National Standards Institute (ANSI)

#The C programming language was developed in the early 70s by AT&Ts Bell Labs which also developed Unix. Today the C standard is maintained by the American National Standards Institute.One advantage of C is that it is very portable between a wide range of computer architectures. In fact, all but the core or kernel of Unix is written in C which means that Unix can be relatively easily ported to new computer types.16V2111 Ch 01-021/9/2012 1:44 PMC Development Environment

#To develop a program in C a programmer first uses an editor to enter or modify the source for the program. To get the program to a state in which it will run, it must go through a series of processes. A preprocessor modifies the source based on preprocessor commands. A compiler translates the language and creates object code which is a close representation to the machine language that a particular computer understands. A linker combines multiple object code files including those stored in library files to create an executable file.17V2111 Ch 01-021/9/2012 1:44 PMExecution Environment

Optionallyunder control of a Debugger#A loader loads the program into memory and then the CPU executes the program in memory generally under the control of the operating system. Sometimes a debugger loads the program and controls its execution.18V2111 Ch 01-021/9/2012 1:44 PMIDEIntegrated Development EnvironmentEditorCompilerDebuggerEx: MS Visual C++Xcode

#Sometimes the editor, compiler, and debugger are managed by an application called an Integrated Development Environment or IDE. Examples include the MS Visual Studio languages including C++ and Xcode on the Mac.19V2111 Ch 01-021/9/2012 1:44 PM

Best Programming Language?#Since there are many programming languages, there are always discussions about which is the best. After you learn C this semester, perhaps you will be able to tell.20V2111 Ch 01-021/9/2012 1:44 PMProgramming in CChapter 1-2Introduction to CT H E E N D##V221111 Ch 01-021/9/2012 1:44 PM