程序设计导论.pptx
《程序设计导论.pptx》由会员分享,可在线阅读,更多相关《程序设计导论.pptx(48页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、1indexReviewingcomputerhardwareIntroductionofprogramminglanguageAlgorithmsStructuredprogrammingThesoftwaredevelopmentprogress第1页/共48页2Computer HardwareComputersareconstructedfromphysicalcomponentsreferredtoashardwareHardwarefacilitatesthestorageandprocessingofdataunderthedirectionofafilesystemComput
2、erhardwaredoesnotstoredatausingthesamesymbolsthathumansdo第2页/共48页3Bits and BytesThesmallestandmostbasicdataiteminacomputerisabitOpenorclosedswitch0or1Thegroupingof8bitstoformalargerunitisreferredtoasabyteCanrepresentanyoneof256distinctpatternsThecollectionsofpatternsconsistingof0sand1susedtorepresen
3、tletters,singledigits,andothersinglecharactersarecalledcharacter codescomputer hardware第3页/共48页4Componentscomputer hardware第4页/共48页5Main Memory Unit(RAM)StoresdataandinstructionsassequenceofbytesAprogrammustresideinmainmemoryifitistooperateonthecomputerCombines1ormorebytesintoasingleunit,referredtoa
4、sawordConstructedasrandomaccessmemory,orRAMEverysectionofmemorycanbeaccessedrandomlyasquicklyasanyothersectionVolatile:dataislostwhenpoweristurnedoffSizeisusuallyspecifiedinbytes(MBorGB)computer hardware第5页/共48页6Central Processing Unit(CPU)Control unit:directsandmonitorstheoveralloperationofthecompu
5、terKeepstrackofwherethenextinstructionresidesIssuesthesignalsneededtobothreaddatafromandwritedatatootherunitsinthesystemExecutesallinstructionsArithmetic and Logic Unit(ALU):performsallofthecomputations,suchasaddition,subtraction,comparisons,andsoon,CPUsareconstructedasasinglemicrochip,whichisreferr
6、edtoasamicroprocessorcomputer hardware第6页/共48页7Input/Output UnitnThe input/output(I/O)unit provides access to the computer,allowing it to input and output datanIt is the interface to which peripheral(外围的)devices,such as keyboards,console screens,and printers,are attachedcomputer hardware第7页/共48页8Sec
7、ondary StoragenUsed as permanent storage for programs and dataMagnetic tape,magnetic disks,and CD-ROMsnDirect access storage device(DASD):allows a computer to read or write any one file or program independent of its position on the storage mediumMagnetic hard disk consists of rigid platters that spi
8、n together on a common spindleInitially,the most common magnetic disk storage device was the removable floppy diskcomputer hardware第8页/共48页9Magnetic Hard Disk扇区柱面道computer hardware第9页/共48页10Programming LanguagesComputer program:dataandinstructionsusedtooperateacomputerandproduceaspecificresultAprogr
9、amorsetofprogramsiscalledsoftwareProgramming:writinginstructionsinalanguagethatthecomputercanrespondtoandthatotherprogrammerscanunderstandProgramming language:setofinstructionsthatcanbeusedtoconstructaprogram第10页/共48页11Machine LanguageExecutable program:programthatcanoperateacomputerExecutableprogra
10、msarewrittenwithbinarynumbers,whichisacomputersinternallanguage(machine language)Anexampleofasimplemachinelanguageprogramcontainingtwoinstructionsis:1100000000000000000100000000001011110000000000000010000000000011Opcodeisshortforoperationcode;tellsthecomputertheoperationtobeperformedProgramming Lang
11、uages第11页/共48页12Assembly LanguagenAssembly language:uses the substitution of word-like symbols for the opcodes,and decimal numbers and labels for memory addresses LOAD firstADD secondMUL factorSTORE answer load R1,R0 load R2,new_number ADD R2,R1 jmp addressProgramming Languages第12页/共48页13Assembly La
12、nguage(continued)Programming Languages第13页/共48页14The level of languages11000000,00000000,00010000,00000010opcodeMachine languageAssembly languageADD op1 op2Language specificationrate=rate+1;High level languagecompileruse instructions that are directly tied to one type of computer.Source codeObject c
13、odeProgramming Languages第14页/共48页15High-to-Low Level Languages(compile&link)Programming Languages第15页/共48页16Data pipe line1+ratedep*R_step1 depositrateoutputrateR_step1depositoutputR_step1registersControlunitWhat is a program(physically)Asetofinstructionsthatcanmakethecomputerrunchronologically.rate
14、=rate+1;result=rate*deposit a program第16页/共48页17Program is a white box for data processing(logically)a program第17页/共48页18Coding an algorithm:construct a white box step by stepAlgorithms第18页/共48页19Algorithms (arithmetic progression)Algorithms第19页/共48页20AlgorithmsAlgorithm:specificstepsrequiredtoprodu
15、ceadesiredresultSet n equal to 100Set a equal to 1Set b equal to 100Calculate sum=n(a+b)/2Display the sumWhenEnglishphrasesareusedtodescribeanalgorithm,thedescriptioniscalledpseudocodeInput the three numbers into the computerCalculate the average by adding the numbers and dividing the sum by threeDi
16、splay the averageAlgorithms第20页/共48页21Algorithms and flowchartAformulaorsetofstepsforsolvingaparticularproblem.Tobeanalgorithm,thesetofrulesmustbeunambiguousandhaveaclearstoppingpoint.Algorithmscanbeexpressedinanylanguage,fromnaturallanguageslikeEnglishorChinese.Algorithms第21页/共48页22flow chartAflowc
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 程序设计 导论
限制150内