Академический Документы
Профессиональный Документы
Культура Документы
ToolsforStructuredandObject
OrientedDesign
Objectives
Indentify,anduseinprogramdesign,the
DOUNTILcontrolStructure
Distinguishbetweenthelogicofa
DOWHILEpatternandthelogicofa
DOUNTILpattern.
UsingtheDoUntilLoop
Whenyouuseeitherawhileoraforloop,thebody
oftheloopmayneverexecute
Whenyouwanttoensurethataloopsbodyexecutesat
leastonetime,youcanuseado untilloop
Inado untilloop,theloopcontrolvariableis
evaluatedaftertheloopbodyexecutes
Therefore,thebodyalwaysexecutesatleastonetime
dountilLoopfor
ProducingOneExtraLabel
PrintingOneLabel,
ThenPrintingEnough
toCoverProduction
Recognizingthe
CharacteristicsSharedbyAllLoops
Allstructuredloopssharethesecharacteristics:
Theloopcontrollingquestionprovideseitherentrytoor
exitfromtherepeatingstructure
Theloopcontrollingquestionsprovidetheonlyentryto
orexitfromtherepeatingstructure
Youshouldalsonoticethedifferencebetween
unstructuredloopsandthestructureddo until
andwhileloops
DOUNTILExample
DOUNTILExample
DOUNTILExample
Pseudocode
DOUNTILExample
DOUNTILExample
DOUNTILExamples
DOWHILEvs.DOUNTIL
DOWHILEvs.DOUNTIL