程序设计导论sk演示教学.ppt

上传人:豆**** 文档编号:60601436 上传时间:2022-11-17 格式:PPT 页数:48 大小:1.11MB
返回 下载 相关 举报
程序设计导论sk演示教学.ppt_第1页
第1页 / 共48页
程序设计导论sk演示教学.ppt_第2页
第2页 / 共48页
点击查看更多>>
资源描述

《程序设计导论sk演示教学.ppt》由会员分享,可在线阅读,更多相关《程序设计导论sk演示教学.ppt(48页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、程序设计导论sk2007ComputerHardwarenComputersareconstructedfromphysicalcomponentsreferredtoashardwarenHardwarefacilitatesthestorageandprocessingofdataunderthedirectionofafilesystemnComputerhardwaredoesnotstoredatausingthesamesymbolsthathumansdo2BitsandBytesnThesmallestandmostbasicdataiteminacomputerisabitO

2、penorclosedswitch0or1nThegroupingof8bitstoformalargerunitisreferredtoasabyteCanrepresentanyoneof256distinctpatternsnThecollectionsofpatternsconsistingof0sand1susedtorepresentletters,singledigits,andothersinglecharactersarecalledcharacter codescomputerhardware3Componentscomputerhardware4MainMemoryUni

3、t(RAM)nStoresdataandinstructionsassequenceofbytesnAprogrammustresideinmainmemoryifitistooperateonthecomputernCombines1ormorebytesintoasingleunit,referredtoasawordnConstructedasrandomaccessmemory,orRAMEverysectionofmemorycanbeaccessedrandomlyasquicklyasanyothersectionVolatile:dataislostwhenpoweristur

4、nedoffnSizeisusuallyspecifiedinbytes(MBorGB)computerhardware5CentralProcessingUnit(CPU)nControl unit:directsandmonitorstheoveralloperationofthecomputerKeepstrackofwherethenextinstructionresidesIssuesthesignalsneededtobothreaddatafromandwritedatatootherunitsinthesystemExecutesallinstructionsnArithmet

5、ic and Logic Unit(ALU):performsallofthecomputations,suchasaddition,subtraction,comparisons,andsoon,nCPUsareconstructedasasinglemicrochip,whichisreferredtoasamicroprocessorcomputerhardware6Input/OutputUnitnTheinput/output(I/O)unitprovidesaccesstothecomputer,allowingittoinputandoutputdatanItistheinter

6、facetowhichperipheral(外围的)devices,suchaskeyboards,consolescreens,andprinters,areattachedcomputerhardware7SecondaryStoragenUsedaspermanentstorageforprogramsanddataMagnetictape,magneticdisks,andCD-ROMsnDirect access storage device(DASD):allowsacomputertoreadorwriteanyonefileorprogramindependentofitspo

7、sitiononthestoragemediumMagnetic hard disk consistsofrigidplattersthatspintogetheronacommonspindleInitially,themostcommonmagneticdiskstoragedevicewastheremovablefloppy diskcomputerhardware8MagneticHardDisk扇区柱面道computerhardware9ProgrammingLanguagesnComputer program:dataandinstructionsusedtooperateaco

8、mputerandproduceaspecificresultAprogramorsetofprogramsiscalledsoftwarenProgramming:writinginstructionsinalanguagethatthecomputercanrespondtoandthatotherprogrammerscanunderstandnProgramming language:setofinstructionsthatcanbeusedtoconstructaprogram10MachineLanguagenExecutable program:programthatcanop

9、erateacomputernExecutableprogramsarewrittenwithbinarynumbers,whichisacomputersinternallanguage(machine language)Anexampleofasimplemachinelanguageprogramcontainingtwoinstructionsis:1100000000000000000100000000001011110000000000000010000000000011nOpcodeisshortforoperationcode;tellsthecomputertheoperat

10、iontobeperformedProgrammingLanguages11AssemblyLanguagenAssembly language:usesthesubstitutionofword-likesymbolsfortheopcodes,anddecimalnumbersandlabelsformemoryaddressesLOAD firstADD secondMUL factorSTORE answer load R1,R0load R2,new_number ADD R2,R1jmp addressProgrammingLanguages12AssemblyLanguage(c

11、ontinued)ProgrammingLanguages13Theleveloflanguages11000000,00000000,00010000,00000010opcodeMachinelanguageAssemblylanguageADDop1op2Languagespecificationrate=rate+1;Highlevellanguagecompileruseinstructionsthataredirectlytiedtoonetypeofcomputer.SourcecodeObjectcodeProgrammingLanguages14High-to-LowLeve

12、lLanguages(compile&link)ProgrammingLanguages15Datapipeline1+ratedep*R_step1depositrateoutputrateR_step1depositoutputR_step1registersControlunitWhatisaprogram(physically)nAsetofinstructionsthatcanmakethecomputerrunchronologically.rate=rate+1;result=rate*depositaprogram16Programisawhiteboxfordataproce

13、ssing(logically)aprogram17Codinganalgorithm:constructawhiteboxstepbystepAlgorithms18Algorithms(arithmeticprogression)Algorithms19AlgorithmsnAlgorithm:specificstepsrequiredtoproduceadesiredresultSet n equal to 100Set a equal to 1Set b equal to 100Calculate sum=n(a+b)/2Display the sumnWhenEnglishphras

14、esareusedtodescribeanalgorithm,thedescriptioniscalledpseudocodeInput the three numbers into the computerCalculate the average by adding the numbers and dividing the sum by threeDisplay the averageAlgorithms20AlgorithmsandflowchartAformulaorsetofstepsforsolvingaparticularproblem.Tobeanalgorithm,these

15、tofrulesmustbeunambiguousandhaveaclearstoppingpoint.Algorithmscanbeexpressedinanylanguage,fromnaturallanguageslikeEnglishorChinese.Algorithms21flowchartnAflowchartisanorganizedcombinationofshapes,lines,andtextthatgraphicallyillustratesaprocessorstructure.Algorithms22FlowchartSymbolsAlgorithms23Flowc

16、hartforcalculatingtheaverageofthreenumbersAlgorithms24structuredprogrammingnAtechniquefororganizingandcodingcomputerprograms:ahierarchyofmodulesisused,eachhavingasingleentryandasingleexitpoint,controlispasseddownwardthroughthestructurewithoutunconditionalbranchestohigherlevelsofthestructure.structur

17、edprogramming25Amodulemustacceptdata,processthedata,andproducearesultstructuredprogramming26StructuredprogrammingAwell-designedprogramisbuiltusingmodulesstructuredprogramming27First-levelstructurediagramstructuredprogramming28Second-levelrefinementstructurediagramstructuredprogramming29TheSoftwareDe

18、velopmentProcessPhaseI:SpecifytheprogramsrequirementsPhaseII:DesignanddevelopmentStep1:AnalyzetheproblemStep2:SelectanoverallsolutionalgorithmStep3:WritetheprogramStep4:TestandcorrecttheprogramPhaseIII:DocumentationPhaseIV:Maintenance30PhaseI:SpecifytheProgramsRequirementsnItisimpossibletoconstructa

19、successfulprogramforaproblemthatisnotfullyunderstood.SoftwareDevelopmentprocess31PhaseII:DesignandDevelopmentnStep1:Analyzetheproblem.Youmustunderstand:TheoutputsthatmustbeproducedTheinputdatarequiredtocreatethedesiredoutputsTheformulasrelatingtheinputstotheoutputsnStep2:Selectanoverallsolutionalgor

20、ithmSoftwareDevelopmentprocess32PhaseII:DesignandDevelopment(continued)SoftwareDevelopmentprocess33PhaseII:DesignandDevelopment(continued)nForlargerprogramsyouwillhavetorefinetheinitialalgorithmandorganizeitintosmalleralgorithms,withspecificationsforhowthesesmalleralgorithmswillinterfacewitheachothe

21、rFirst-level structure diagram foranalgorithmisthefirstattemptatastructureforasolutionalgorithmTop-down algorithm development startsatthetopmostlevelandproceedstodevelopmoreandmoredetailedalgorithmsasitproceedstothefinalsetofalgorithmsSoftwareDevelopmentprocess34PhaseII:DesignandDevelopment(continue

22、d)SoftwareDevelopmentprocess35PhaseII:DesignandDevelopment(continued)SoftwareDevelopmentprocess36PhaseII:DesignandDevelopment(continued)nThesooneryoustartprogramminganapplication,thelongeritusuallytakestodebugandcomplete.SoftwareDevelopmentprocess37PhaseII:DesignandDevelopment(continued)nStep3:Write

23、theprogram(orcodethealgorithm)Sequence structuredefinestheorderinwhichinstructionsareexecutedbytheprogramSelection structureprovidesthecapabilitytomakeachoicebetweendifferentinstructions,dependingontheresultofsomeconditionRepetition structure,alsocalledlooping oriteration,providestheabilityforthesam

24、eoperationtoberepeatedbasedonthevalueofaconditionInvocation SoftwareDevelopmentprocess38PhaseII:DesignandDevelopment(continued)nStep4:TestandcorrecttheprogramAprogramerroriscalledabugTestingattemptstoensurethataprogramworkscorrectlyandproducesmeaningfulresultsIfyoufindanerror,initiatedebugging:locat

25、ing,correcting,andverifyingthecorrectionDevelopasetoftestdatathatdetermineswhethertheprogramgivescorrectanswersThetestsshouldexamineeverypossiblesituationunderwhichaprogramwillbeusedSoftwareDevelopmentprocess3940PhaseIII:DocumentationnSixdocumentsforeveryproblemsolution:1.Therequirementsstatement2.A

26、descriptionofthealgorithmsthatwerecoded3.Commentswithinthecodeitself4.Adescriptionofmodificationandchangesmadeovertime5.Sampletestruns,whichincludetheinputsusedforeachrunandtheoutputobtainedfromtherun6.Ausersmanual,whichisadetailedexplanationofhowtousetheprogramSoftwareDevelopmentprocess41CaseStudy:

27、circumferenceofcirclenVoidmain()nStatements;compoundstatements;n/commentsSoftwareDevelopmentprocess42PhaseIV:MaintenancenHoweasilyaprogramcanbemaintained(corrected,modified,orenhanced)isrelatedtotheeasewithwhichtheprogramcanbereadandunderstoodSoftwareDevelopmentprocess43BackupnMakingandkeepingbackup

28、copiesofyourworkwhenwritingaprogramiscriticalNotpartoftheformalsoftwaredevelopmentprocessnBackupisunimportantifyoudontmindstartingalloveragainnManyorganizationskeepatleastonebackuponsitewhereitcanbeeasilyretrieved,andanotherbackupcopyeitherinafireproofsafeorataremotelocationSoftwareDevelopmentproces

29、s44WhatisaProgrammingLanguagefor(conclusion)nProgrammingisanexplanatoryactivityToyourself,nowandinthefuture.Towhoeverhastoreadyourcode.Tothecompiler,whichhastomakeitrun.nExplanationsrequirelanguageTostateclearlywhatisgoingon.Tocommunicateideasoverspaceandtime.45HowtomakeaniceprogramnAnalysistheproblemnCorrectalgorithmnNicestructurenCodingwithCommentsnDebuggingndocumentation46Theassignment:nFinishandhandinpersonalwebpage(10.8)nReadthematerialrecommendedinChapterone.Includetheexercises.47此课件下载可自行编辑修改,仅供参考!此课件下载可自行编辑修改,仅供参考!感谢您的支持,我们努力做得更好!谢谢感谢您的支持,我们努力做得更好!谢谢

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com