SFC

AStructuredFlowEditor

Version2.3 User’sGuide

TiaWatts,Ph.D. SonomaStateUniversity

1of35 SFC–AStructuredFlowChartEditor Version2.3 User’sGuide

TableofContents

1. Introduction ...... 3 2. GettingStartedwithSFC ...... 4 3. TheSFCEnvironment...... 5 4. CreatingaNewStructuredFlowChart...... 7 5. OpeninganExistingStructuredFlowChart ...... 8 6. InsertingaNewProcedure ...... 8 7. InsertingControlStructures ...... 11 a. SequentialProcessorActivity ...... 12 b. InputorOutput...... 13 . SubroutineCall...... 14 d. SingleDecision ...... 15 e. DoubleDecision...... 16 f. CaseStatement ...... 17 g. CaseOption...... 18 h. TestattheTopLoop ...... 19 i. TestattheBottomLoop...... 20 j. CountingLoop...... 21 k. UserControlledExitLoop ...... 22 8. InsertingDocumentation...... 23 9. ModifyingControlStructures ...... 24 10.TransformingControlStructures ...... 24 11.UsingCut,Copy,andPaste...... 26 12.PrintingaStructuredFlowChart ...... 28 13.ViewingandPrintingPseudoCode ...... 28 14.SavingaStructuredFlowChart ...... 29 15.ClosingaStructuredFlowChartView ...... 30 16.ExportingSVGandTXTfiles ...... 30 17.EditingMultipleStructuredFlow...... 31 18.ExitingfromSFC ...... 31 AppendixA:FlowChartSymbols...... 32 AppendixB:Examples ...... 33

SoftwareandDocumentationCopyrightTiaWatts2001

2of35 1.Introduction

Programdevelopmentcanbedescribedasasevenstepprocess:

1. Understandtheproblem. 2. Planthelogicoftheprogram. 3. Codetheprogramusingastructuredhighlevelcomputerlanguage. 4. Usingacompiler,translatetheprogramintoamachinelanguage. 5. Testanddebugtheprogram. 6. Puttheprogramintoproduction. 7. Maintainandenhancetheprogram.

Planningthelogicoftheprogramrequiresthedevelopmentof.Anisa finite,orderedsetofunambiguousstepsthatterminateswithasolutiontotheproblem.Human readablerepresentationssuchasflowchartsandpseudocodearetypicallyusedtodescribethe stepsofanalgorithmandtherelationshipsamongthesteps.

Aflowchartisagraphicalrepresentationofthestepsandcontrolstructuresusedinanalgorithm. Aflowchartdoesnotinvolveaparticularprogramminglanguage,butratherusesasetof geometricsymbolsandflowcontrollinestodescribethealgorithm.Fromaflowchart,a programmercanproducethehighlevelcoderequiredtocompileanexecutableprogram.

Initially,thestandardfordescribingflowchartsonlyspecifiedthetypesofshapesandlinesused toproduceaflowchart.Theintroductionofstructuredprogramminginthe1960’sand70’s broughtwithittheconceptofStructuredFlowCharts.Inadditiontoastandardsetofsymbols, structuredflowchartsspecifyconventionsforlinkingthesymbolstogetherintoacompleteflow chart.

Thestructuredprogrammingparadigmevolvedfromthemathematicallyprovenconceptthatall problemscanbesolvedusingonlythreetypesofcontrolstructures: Sequence Decision(orSelection) Iterative(orlooping).

Thedefinitionofstructuredflowchartsusedinthisdocumentandsoftwarefurtherdefines: 3typesofsequentialstructures: Process,Input/Output,andSubroutineCall 3typesofdecisionstructures SingleBranch,DoubleBranch,andCase 4typesofiterativestructures TestattheTop,TestattheBottom,Counting,andUserControlledExit.

TheSFCprogramisdesignedtoaidtheprogrammerindesigningandpresentingstructuredflow charts.Inaddition,SFCwillautomaticallygeneratepseudocodeforaflowchartastheflow chartisbeingcreated.

3of35 2.GettingStartedwithSFC

TostarttheSFCprogram:

PlacethediskcontainingtheSCFprogramintheA:drive. FromtheStartmenu,selecttheRunoption. Entera:\sfcintheRundialogboxandclickonOKorpresstheenterkey.

ORifyouhavecopiedtheSFCprogramontotheharddrive(C:)ofyourcomputer

FromtheStartmenu,selecttheRunoption. Enterc:\sfcintheRundialogboxandclickonOKorpresstheenterkey.

OnceyouhavestartedtheSFCprogram,themainwindowwillbedisplayed:

Usingtheleftmousebutton,clickonOKtoproceed.

Youcanmaximizethesizeofthiswindowbyclickingonthefullscreenbuttonintheupperright cornerofthewindowframe.

4of35 3.TheSFCEnvironment

MinimizeMaximizeExit

MenuBar

ToolBar

StatusBar

Create Open SavePrintCutCopyPasteUndoZoom ZoomHelp New Exist- Chart In Out Flow ing to Chart Chart Disk

TheFilemenuincludesoptionsallowingtheuserto: • CreateanewSFCflowchartdocument • OpenanexistingSFCflowchartdocument • SavethecurrentSFCflowchartdocumenttoafile • SavethecurrentSFCflowchartdocumenttoanewlynamedfile • ExportthecurrentSFCflowcharttoanSVGorTXTfile • PrintthecurrentSFCflowchartorpseudocodeview • PreviewtheprintversionofthecurrentSFCflowchartorpseudocodeview • Settheprintingparameters • ViewandselectfromalistofrecentSFCflowchartdocuments • ExitfromtheSFCEditor.

TheEditmenuincludesoptionsallowingtheuserto: • UndothemostrecentmodificationmadetothecurrentSFCflowchart • CuttheselectedcontrolstructureorsubroutinefromthecurrentSFCflowchart • CopytheselectedflowchartelementfromthecurrentSFCflowcharttotheclipboard • CopytheselectedpseudocodefromthecurrentSFCpseudocodeviewtotheclipboard • Pastetheflowchartelementstoredontheclipboardintotheselectedinsertionpointin thecurrentSFCflowchart • InsertanewflowchartelementattheselectedinsertionpointinthecurrentSFCflow chart • ModifytheselectedcontrolstructureorsubroutineinthecurrentSFCflowchart. • TransformtheselectedcontrolstructureinthecurrentSFCflowcharttoanothercontrol structure.

5of35 TheViewmenuincludesoptionsallowingtheuserto: • VieworhidetheToolBar • VieworhidetheStatusBar • SelecttheGenericstyleofpseudocodeforthecurrentSFCflowchart • SelecttheC++styleofpseudocodeforthecurrentSFCflowchart • Includelinenumbersinthepseudocodewindow

TheWindowmenuincludesoptionsallowingtheuserto: • CreateacopyofthecurrentSFCflowchartinanewwindow • DisplayacascadeoftheopenSFCflowchartdocuments • DisplayahorizontaltilingoftheopenSFCflowchartdocuments • ViewandselectfromalistoftheopenSFCflowchartdocuments.

TheHelpmenuincludesoptionsallowingtheuserto: • ViewSFCversioninformation.

TheleftmousebuttonisusedtoselectormodifyanelementinthecurrentSFCflowchart: • Pointingtothesymbolassociatedwithacontrolstructure,subroutine,orinsertionpoint andsingleclickingtheleftmousebuttonwillselecttheelement.Iftheselectedelementis acontrolstructureorsubroutine,selectionwillbeindicatedbyadashed-line enclosingthecompletestructureorsubroutine.Iftheselectedelementisaninsertion point,selectionwillbeindicatedbyadashed-linesquareenclosingtheinsertionpoint. • Pointingtothesymbolassociatedwithacontrolstructure,subroutine,orinsertionpoint anddoubleclickingtheleftmousebuttonwillallowtheusertomodifytheelement.Ifthe elementisacontrolstructureorsubroutine,theappropriatetextentrydialogboxwillbe displayed.Iftheelementisaninsertionpoint,theappropriateinsertiondialogboxwillbe displayed.

Theleftmousebuttonisalsousedtoselectasegmentofthecurrentpseudocode.

Therightmousebuttonisusedtodisplaypop-upmenus: • Pointingtothesymbolassociatedwithacontrolstructureorsubroutineandclickingthe rightmousebuttonwilldisplayapop-upmenuwithoptionsto: o Copythecontrolstructureorsubroutinetotheclipboard o Cutthecontrolstructureorsubroutineandplaceacopyontheclipboard o Deletethecontrolstructureorsubroutine o Modifythecontrolstructureorsubroutine o Transformthecontrolstructure • Pointingtoaninsertionpointandclickingtherightmousebuttonwilldisplayapop-up menuwithoptionsto: o Insertanewcontrolstructureorsubroutineattheinsertionpoint o Pasteacopyoftheappropriatecontrolstructureorsubroutineontheclipboardat theinsertionpoint.

6of35 4.CreatingaNewStructuredFlowChart

Tocreateanewstructuredflowchart:

ClickonthewordFileinthemainSFCmenubar. SelecttheNewoptioninthefilemenu. OR ClickontheblankpageiconintheSFCtoolbar.

ANewProgramdialogboxwillbedisplayed.Usethisdialogboxtonametheprogramand identifyyourselfastheauthor.

Thenewflowchart,displayedontheleftsideofthescreen,consistsofaprocedurecalled “main”andtwosubroutineinsertionpoints(thelargeshadedcircles).The“main”subroutine(a procedure)isidentifiedbySTARTandSTOPlabelsandcontainsasinglecontrolstructure insertionpoint(thesmallshadedcircleonthecontrolflowlinesbetweenSTARTandSTOP). Read-onlypseudocodeforthemainprocedureisdisplayedontherightsideofthescreen.

7of35 5.OpeninganExistingStructuredFlowChart

Toopenandeditasavedstructuredflowchart:

SelecttheOpenoptioninthefilemenu. Selectorenterthenameofthefile. ClickonOKorpresstheenterkey. OR ClickontheopenfoldericonintheSFCtoolbar. Selectorenterthenameofthefile. ClickonOKorpresstheenterkey.

6.InsertingaNewSubroutine(ProcedureorFunction)

Typically,programsaredesignedasasetofsubroutines,oneofwhichisdesignatedasthe “main”subroutine.Whentheprogramisexecuted,executionbeginswiththefirststatementin the“main”subroutine.Theothersubroutinesintheprogramarecalledbythe“main”subroutine and/orbyeachother.

Subroutinescanbedividedintotwocategories:functionsandprocedures.Afunctionreturnsa valuetothecallingsubroutine,aproceduredoesnot.Bothfunctionsandprocedurescanhave informationpassedtothembythecallingsubroutine;thisisusuallydonebysupplyingalistof actualparametervalueswhenthesubroutineiscalled.Theformaldescriptionsoftheparameter valuesexpectedbythesubroutinearedeclaredaspartofthesubroutine.

Anewfunctionorprocedurecanbeinsertedatasubroutineinsertionpoint(representedbya largeshadedcircle).Toinsertanewfunctionorprocedure,doubleclicktheleftmousebutton whilepointingtothesubroutineinsertionpoint.Adialogboxwillbedisplayed:

8of35 InsertingaNewProcedure

Enterthenameofthenewprocedureandthelistofparameternamesinthedialogboxandthen leftclickonOKorpresstheenterkey.

InitiallythenewprocedureconsistsofSTARTandSTOPlabelsandacontrolstructureinsertion point.Inaddition,whenanewprocedureisaddedtoaprogram,subroutineinsertionpointswill beplacedbeforeandafterthenewprocedure.

9of35 InsertingaNewFunction

Enterthenameofthenewprocedureandthelistofparameternamesinthedialogbox.In addition,thevaluetobereturnedanditstypeshouldbeenteredinthedialogboxbeforeleft clickingonOKorpressingtheenterkey.

InitiallythenewfunctionconsistsofSTARTandSTOPlabelsandacontrolstructureinsertion point.ThereturnvaluewillbeindicatedintheSTOPlabel.Inaddition,whenanewfunctionis addedtoaprogram,subroutineinsertionpointswillbeplacedbeforeandafterthenewfunction.

10of35 7.InsertingControlStructures

Controlstructuresareinsertedbydoubleclickingtheleftmousebuttonwhilepointingtoa controlstructureinsertionpoint.Thecontrolstructureinsertionpointsarerepresentedassmall shadedcirclesonthecontrolflowlinesofaprocedure.Onsomescreens,controlstructure insertionpointcirclesmayactuallyappearassmallshadeddiamonds.

Whentheleftmousebuttonisdoubleclicked,acontrolstructureinsertiondialogboxwillbe displayed.Thetypeofcontrolstructureisdeterminedbyleftclickingontheappropriateradio button.Afterselectingthecontrolstructuretype,leftclickonOKorpresstheenterkey.Adialog boxfortheselectedcontrolstructuretypewillbedisplayed.Afteranewcontrolstructureis insertedinaprocedure,controlstructureinsertionpointswillbeplacedbeforeandafterthenew structure.Thisdialogboxwillalsobeusedwhenaddingdocumentingcommentstoaflowchart.

Thefollowingsectionsdescribeeachofthetypesofcontrolstructuresthatcanbeaddedtothe flowchart.

11of35 a.SequentialProcessesorActivity

TheSequentialProcesssymbolisusedtorepresentcalculations,processes,andother unambiguousactions.

Afterselectingthesequentialprocessoptionoftheinsertnewcontrolstructuredialogueboxand leftclickingonOKorpressingtheEnterkey,adialogueboxforenteringthecontentsofthe sequentialprocesssymbolwillbedisplayed:

Afterenteringthestatementassociatedwiththesequentialprocessinthedialogbox,leftclickon OKorpresstheEnterkey.Thenewsequentialprocesssymbolanditscontentswillthenbe displayedintheflowchart:

12of35 b.InputorOutput

TheInputorOutputsymbolisusedtorepresentinput(read)oroutput(write)statements.

Afterselectingtheinputoroutputoption,adialogueboxforenteringthecontentsoftheinput /outputsymbolwillbedisplayed:

Afterenteringthestatementassociatedwiththeinput/outputstatementinthedialogbox,left clickonOKorpresstheEnterkey.Thenewinput/outputsymbolanditscontentswillthenbe displayedintheflowchart:

13of35 c.SubroutineCall

TheSubroutineCallsymbolisusedtorepresentexecutionofapredefinedprocessorgroupof processes.Thenameofthesubroutineandvaluestobepassedtothesubroutineshouldbe enclosedwithinthesubroutinecallsymbol.

Afterselectingthesubroutinecalloption,adialogueboxforenteringthecontentsofthe subroutinecallsymbolwillbedisplayed:

Afterenteringthestatementassociatedwiththesubroutinecallstatementinthedialogbox,left clickonOKorpresstheEnterkey.Thenewsubroutinecallsymbolanditscontentswillthenbe displayedintheflowchart:

14of35 d.SingleDecision

Thedecisionsymbolisusedtorepresentacomparison,question,test,selection,ordecisionthat determinesanalternativepathtobefollowed.Thesinglebranchdecisionstructurehasacontrol structureinsertionpointonlyontheTrue(T)branchofthedecisionsymbol.Controlstructures placedontheTruebranchofasingledecisionstructureareonlyexecutedifthetestenclosedin thedecisionsymbolistrue.Iftheresultofthetestisfalse,thestructuresontheTruebranchare by-passed.

Afterselectingthesingledecisionoption,adialogueboxforenteringthecontentsofthedecision symbolwillbedisplayed:

Afterenteringtheconditionassociatedwiththesinglebranchdecisionstatementinthedialog box,leftclickonOKorpresstheEnterkey.Thenewdecisionsymbol,itsconditionandatrue branchcontainingasinglestructureinsertionpointwillthenbedisplayedintheflowchart:

15of35 e.DoubleDecision

ThedoublebranchdecisionstructurehascontrolstructureinsertionpointsonboththeTrue(T) andFalse(F)branchesofthedecisionsymbol.Onlyonepathwillbefollowedafterthetest enclosedinthedecisionsymbolisevaluated.

Afterselectingthedoubledecisionoption,adialogueboxforenteringthecontentsofthe decisionsymbolwillbedisplayed:

Afterenteringtheconditionassociatedwiththedoublebranchdecisionstatementinthedialog box,leftclickonOKorpresstheEnterkey.Thenewdecisionsymbol,itsconditionandtrueand falsebranches,eachcontainingasinglestructureinsertionpoint,willthenbedisplayedinthe flowchart:

16of35 f.CaseStatements

Thecase,ormulti-branchdecision,structurehasinsertionpointsforcaseoptionstatementsanda defaultbranch.Onlyonepathwillbefollowedafterthestatementenclosedinthedecision symbolisevaluated.

Afterselectingthecasestatementoption,adialogueboxforenteringthecontentsofthecase selectionstatementwillbedisplayed:

Afterenteringthestatementassociatedwiththecasestatementinthedialogbox,leftclickon OKorpresstheEnterkey.Thenewcasesymbol,itsselectionstatementandcaseoptionand defaultbrancheswillthenbedisplayedintheflowchart:

17of35 g.CaseOptions

ThedoublebranchdecisionstructurehascontrolstructureinsertionpointsonboththeTrue(T) andFalse(F)branchesofthedecisionsymbol.Onlyonepathwillbefollowedafterthetest enclosedinthedecisionsymbolisevaluated.

Afterdoubleclickingtheleftbuttononacaseoptioninsertionpoint,adialogueboxforentering thecontentsoftheoptiondecisionsymbollabelwillbedisplayed:

Afterenteringthevalueassociatedwiththecaseoptioninthedialogbox,leftclickonOKor presstheEnterkey.Thenewoptiondecisionsymbol,itsvalueandapathcontainingasingle structureinsertionpoint,willthenbedisplayedintheflowchart:

18of35 h.TestattheTopLoop

Looping,oriterative,structuresareusedtorepresentrepetitiveactions.Theloopcontrolsymbol containsacomparison,question,test,ordecisionthatdetermineswhichbranchoftheloopwill beexecuted.Initially,thetruebranchoftheloopcontainsacontrolstructureinsertionpoint. Controlstructuresinsertedonthetruebranchoftheloopcomprisethebodyoftheloop.TheTest attheTopLoopperformsthetestpriortoexecutingthebodyoftheloop.Aslongasthetest resultistrue,thebodyoftheloopwillcontinuetobeexecuted.Iftheresultofthetestisfalse, iterativeexecutionofthebodyoftheloopwillbeterminated.Insomecases,thebodyofatestat thetoploopmaynotbeexecutedatall.

Afterselectingthetestatthetoploopoption,adialogueboxforenteringthecontentsoftheloop decisionsymbolwillbedisplayed:

Afterenteringtheconditionassociatedwiththetestatthetoploopingstatementinthedialogbox andselectingthedesiredformat,leftclickonOKorpresstheEnterkey.Thenewloopdecision symbol,itscontentsandatruebranchcontainingasinglestructureinsertionpointwillthenbe displayedintheflowchart:

19of35 i.TestattheBottomLoop

TheTestattheBottomLoopperformsthetestafterexecutingthebodyoftheloop.Aslongas theresultofthetestistrue,thebodyoftheloopwillcontinuetobeexecuted.Iftheresultofthe testisfalse,iterativeexecutionofthebodyoftheloopwillbeterminated.Thebodyofatestat thebottomloopwillalwaysbeexecutedatleastonetime.

Afterselectingthetestatthebottomloopoption,adialogueboxforenteringthecontentsofthe loopdecisionsymbolwillbedisplayed:

Afterenteringtheconditionassociatedwiththetestatthebottomloopingstatementinthedialog box,leftclickonOKorpresstheEnterkeyThenewloopdecisionsymbolanditscontentsanda entryflowlinecontainingasinglestructureinsertionpointwillthenbedisplayedintheflow chart:

20of35 j.CountingLoop

Thecountingloopperformsbodyofthelooponceforeachdesiredvalueoftheloopcontrol variable.Whenthevalueoftheloopcontrolvariableisoutsideoftheindicatedbounds,iterative executionofthebodyoftheloopwillbeterminated.Insomecases,thebodyofacountingloop maynotbeexecutedatall.

Afterselectingthecountingloopoption,adialogueboxforenteringthecontentsoftheloop headersymbolwillbedisplayed:

OR

Afterenteringtheloopcontrolvariableandthedesiredstarting,ending,andstepvaluesinthe dialog,leftclickonOKorpresstheEnterkey.Thenewloopheadersymbol,itscontentsanda truebranchcontainingasinglestructureinsertionpointwillthenbedisplayedintheflowchart:

OR

21of35 k.UserControlledExitLoop

TheUserControlledExitLoopperformsbodyoftheloopuntiltheexitconditionistrue.Aslong asthetestresultisfalse,thebodyoftheloopwillcontinuetobeexecuted.Insomecases,the portionoftheloopbodyfollowingtheexittestmaynotbeexecutedatall.

Afterselectingtheusercontrolledexitloopoption,adialogueboxforenteringthecontentsof theloopdecisionsymbolwillbedisplayed:

Afterenteringtheconditionassociatedwiththeuserloopingstatementinthedialogboxand selectingthedesiredformat,leftclickonOKorpresstheEnterkey.Thenewloopdecision symbol,itscontentsandapathcontainingastructuresinsertionpointsbeforeandaftertheexit conditionwillthenbedisplayedintheflowchart:

22of35 8. InsertingDocumentation

Documentationcanbeaddedtoaflowchartatstructureinsertionpoints.Doubleclickonthe insertionpointtodisplaythecontrolstructuredialogbox.Afterselectingthecommentoption,a dialogueboxforenteringthecontentsofthecommentwillbedisplayed:

Afterenteringthecommentinthedialogboxandselectingthedesiredformat,leftclickonOK orpresstheEnterkey.Thenewcommentwillthenbedisplayedintheflowchartinadashed boxtotheleftorrightofthelineofflowoftheflowchartstructure:

23of35 9.ModifyingControlStructures

Thecontentsofacontrolstructurecanbemodifiedbydoubleclickingtheleftmousebutton whilepointingtothesymbolrepresentingthecontrolstructure.Thecurrentcontentswillbe displayedintheappropriatedialogbox.Afterthecontentshavebeenmodified,clickonOKor presstheenterkeytosavethemodification.Themodifiedstructurewillbedisplayedintheflow chart.

10.TransformingControlStructures

Thetransformoptioncanbeusedtochangethetypeofacontrolstructure.Forexample,asingle branchdecisionstructurecanbechangedtoadualbranchdecisionoratestatthetoploopcanbe changedtoatestatthebottomloop.

Totransformacontrolstructure:

Selectthestructurebyleftclickingonthesymbolrepresentingthestructure. Then: Selectthetransformoptionintheeditmenu. OR Rightclickonthestructureandselectthetransformoptioninthepop-upmenu.

SelectthedesiredstructureandclickonOK.

BeforeAfter

Thetextentrydialogboxforthenewstructurewillbedisplayedsothatyoumayverifythe textualcontentsofthestructureand,ifapplicable,selectaformatforthenewstructure.Thenew structurewillreplacetheoriginalstructureintheflowchart.

24of35 Insomecases,flowchartstructureswillbelostwhenatransformationisperformed.For example,inthefollowingexample,whereadoubledecisionstructureistransformedintoasingle decisionstructure,thefalsebranchislost:

Before After

Thefollowingtabledescribestheactionsperformedwhenastructureistransformedtoa differentstructure.(N/A=Notapplicable;N/I=Notimplemented)

From/To Seq. I/O Call Single Double Sel. Top Bottom User Count Com. Sequential N/A OK OK OK OK OK OK OK OK N/I OK Inputor OK N/A OK OK OK OK OK OK OK N/I OK Output Subroutine OK OK N/A OK OK OK OK OK OK N/I OK Call Single True True True N/A OK OK OK OK OK N/I True Branch branch branch branchlost branch lost lost lost Double T/F T/F T/F False N/A OK False False OK N/I T/F Branch branches branches branches branch branch branch branches lost lost lost lost lost lost lost Selection All All All First First/ N/A First First First/ N/I All branches branches branches branch default branch branch default branches lost lost lost kept kept kept kept kept lost TestatTop Loop Loop Loopbody OK OK OK N/A OK OK N/I Loop bodylost bodylost lost bodylost Testat Loop Loop Loopbody OK OK OK OK N/A OK N/I Loop Bottom bodylost bodylost lostLoop bodylost bodylost User Pre/post Pre/post Pre/post Postexit OK OK Postexit Postexit N/A N/I Pre/post Controlled exitbody exitbody exitbody body body body exitbody lost lost lost lost lost lost lost Counting N/I N/I N/I N/I N/I N/I N/I N/I N/I N/A N/I Comment OK OK OK OK OK OK OK OK OK N/I N/A

25of35 11.UsingCut,Copy,andPastetoModifyFlowCharts

Cut,copy,andpastecanbeusedtoremove,move,orduplicatecontrolstructures,functions,and proceduresinaflowchart.

Toselectthecontrolstructure,procedure,orinsertionpointthatwillbethetargetofthecut,past orcopycommand,pointtothestructuresymbolandclicktheleftmousebutton.Thecurrent (selected)componentwillbeoutlinedwithadashedlineboxintheflowchart.Iftheselected componentisacontrolstructure,thetextassociatedwiththestructurewillbehighlightedinthe pseudocode.

Tocutacontrolstructure:

Selectthestructurebyleftclickingonthesymbolrepresentingthestructure. Then: Selectthecutoptionintheeditmenu. OR Clickonthescissorsiconinthetoolbar. OR Rightclickonthestructureandselectthecutoptioninthepop-upmenu.

26of35 Thecontrolstructurewillberemovedfromtheflowchartandplacedonthecontrolstructure clipboard.

Tocopyacontrolstructure:

Selectthestructurebyleftclickingonthesymbolrepresentingthestructure. Then: Selectthecopyoptionintheeditmenu. OR Clickontheduplicateiconinthetoolbar. OR Rightclickonthestructureandselectthecopyoptioninthepop-upmenu.

Acopyofthecontrolstructurewillbeplacedonthecontrolstructureclipboard.

Topasteacontrolstructure:

Selectaninsertionpointbyleftclickingonthesmallshadedcirclerepresentingthecontrol structureinsertionpoint. Then: Selectthecopyoptionintheeditmenu. OR Clickonthepastefromclipboardicononthetoolbar. OR Rightclickontheinsertionpointandselectthepasteoptioninthepop-upmenu.

Ifacontrolstructureinsertionpointhasbeenselected,acopyofthecontrolstructuremost recentlyplacedontheclipboardbyacutorcopycommandwillbeinsertedattheselected controlstructureinsertionpoint.

Ifasubroutineinsertionpointhasbeenselected,acopyofthesubroutinemostrecentlyplaced ontheclipboardbyacutorcopycommandwillbeinsertedattheselectedsubroutineinsertion point.

Ifacaseoptioninsertionpointhasbeenselected,acopyofthecaseoptionmostrecentlyplaced ontheclipboardbyacutorcopycommandwillbeinsertedattheselectedcaseoptioninsertion point.

CopyingFlowChartorPseudoCodeStatementsintoOtherApplications

Segmentsofaflowchartcanbecopiedandpastedasfigurestowordprocessing,drawing, presentationgraphics,andotherapplicationsbyselectingthesegment,usingtheSFCEdit/Copy commandtocopythegraphictothesystemclipboardandpastingitintotheotherapplication. Similarly,segmentsofpseudocodecanbecopiedandpastedastextintootherapplications.

27of35 12.PrintingaStructuredFlowChart

TopreviewaprintedStructuredFlowChart:

SelectthePrintPreviewoptionontheFilemenu.

Theprintedversionoftheflowchartwillbedisplayed.Eachprocedurewillbedisplayedona separatepage.Eachprocedureisscaledtofitwithinthemarginsofan8½“by11”page.

ToprintaStructuredFlowChart: SelectthePrintoptionontheFilemenu. OR Clickontheprintericononthetoolbar.

13.ViewingandPrintingPseudoCode

PseudocodewillbeautomaticallygeneratedforaStructuredFlowChartasitisbeingcreated.

ToselectthePseudoCodeStyle: SelecttheC++StyleoptionontheViewmenu(default). OR SelecttheGenericStyleoptionontheViewmenu.

28of35

TopreviewtheprintedPseudoCode: Afterleftclickinginthepseudocodeframe, SelectthePrintPreviewoptionontheFilemenu.Theprintedversionofthepseudo codewillbedisplayed.

Toprintthepseudocode: Afterleftclickinginthepseudocodeframe, SelectthePrintoptionontheFilemenu. OR Clickontheprintericononthetoolbar.

14.SavingaStructuredFlowChart

Astructuredflowchartcanbesavedasafileonadisk.

Tosaveastructuredflowchart:

SelecttheSaveoptionontheFilemenu. OR Clickonthediskicononthetoolbar.

Tosaveastructuredflowchartusingadifferentname:

SelecttheSaveAsoptionontheFilemenu. Clickonafilenameorenteranewnameinthedialogbox. ClickontheOKbuttonorpresstheenterkey.

29of35 15.ClosingaStructuredFlowChartView

Tocloseastructureflowchartviewwindow:

SelecttheCloseoptionontheFilemenu. OR ClickontheXbuttonintheupperrightcornerofthestructuredflowchartviewframe.

16. ExportingSVGandTXTfiles

TheExportAsoptionoftheFilemenucanbeusedtocreateScalableVectorGraphics(.svg)or text(.txt)files.

ScalableVectorGraphics(SVG)isagraphicsformatdesignedbyAdobeandbasedonXML. SVGfilescanbeviewedusingtheAdobeSVGViewer.SVGfilescanbeincorporatedintoweb pages.SinceSVGfilesaretextfiles,theycanbemodifiedusingatexteditor.

TosaveastructuredflowchartasanSVGfile:

SelecttheExportAsoptionontheFilemenu. SelectScalableVectorGraphicFiles(.svg)astheSaveastype Clickonafilenameorenteranewnameinthedialogbox. ClickontheOKbuttonorpresstheenterkey.

Thepseudocodeassociatedwithaflowchartcanbeexportedtoatextfileforfurthereditingor compiling.Thepseudocodefilewillbewrittenusingtheformat(GenericorC++)selectedfrom theViewmenu.

Tosaveastructuredflowchartasatextfile:

SelecttheExportAsoptionontheFilemenu. SelectTextFiles(.txt)astheSaveastype Clickonafilenameorenteranewnameinthedialogbox. ClickontheOKbuttonorpresstheenterkey.

30of35 17.EditingMultipleStructuredFlowCharts

Usingmultiplewindows,twooremoreflowchartscanbeeditedatthesametime.Followthe instructionsinsections4or5toopenasecondneworexistingflowchart.

Toviewmultipleflowchartsoneabovetheother: SelecttheTileoptiononthewindowsmenu.

Controlstructuresorprocedurescutorcopiedfromonestructuredflowchartcanbepastedtothe appropriatetypeofinsertionpointinanotherflowchart.

18.ExitingfromSFC

ToexitfromSFC:

LeftclickontheXbuttonontheupperrightcorneroftheSCFmainwindow. OR SelecttheExitoptionintheFilemenu.

31of35 AppendixA:FlowChartSymbols

SubroutineSTART/STOPwith ControlStructureInsertionPoint

Comment(2formats) TestatTopLoop(4formats)

SequentialProcessorActivity

TestatBottomLoop(2formats)

InputorOutput

SubroutineCall CountingLoop

SingleBranchDecision(2formats)

DoubleBranchDecision(2formats)

UserControlledExitLoop(4formats)

CaseStatementwithCaseOption

32of35 AppendixB:Examples

Example1SequentialSearch

ThisexampleillustratesaprocedureimplementationoftheSequentialSearchalgorithm.The flowchart,itsGenericstylepseudocode,anditsC++stylepseudocodeareshown.

FlowChart GenericStylePseudoCode

PROCEDURESeq_Search() BEGINSeq_Search readtargetvalue(TV) letFOUND=no WHILEvaluesinlistandFOUND=noDO readvaluefromlist(LV) IFTV=LVTHEN letFOUND=yes END-IF END-WHILE IFFOUND=yesTHEN write"Targetvaluefoundinlist." ELSE write"TargetvalueNOTfoundinlist." END-IF

ENDSeq_Search

C++StylePseudoCode

voidSeq_Search() { readtargetvalue(TV); letFOUND=no; while(valuesinlistandFOUND=no) { readvaluefromlist(LV); if(TV=LV) letFOUND=yes; } if(FOUND=yes) write"Targetvaluefoundinlist."; else write"TargetvalueNOTfoundinlist."; }

1of35 Example2BinarySearch

ThisexampleillustratesafunctionimplementationoftheBinarySearchalgorithm.Theflow chart,itsGenericstylepseudocode,anditsC++stylepseudocodeareshown.

2of35 GenericStylePseudoCode

FUNCTIONBinarySearch(integervalue,integerslist)RETURNINGboolean BEGINBinarySearch IFlistcontainsonevalueTHEN IFvalueequalonlyvalueinlistTHEN found=true ELSE found=false END-IF ELSE test=middlevalueinlist IFvalueequaltestvalueTHEN found=true ELSE IFvaluelessthantestvalueTHEN found=BinarySearch(value,listvaluesprecedingtest) ELSE found=BinarySearch(value,listvaluesfollowingtest) END-IF END-IF END-IF RETURNfound ENDBinarySearch

C++StylePseudoCode booleanBinarySearch(integervalue,integerslist) { if(listcontainsonevalue) { if(valueequalonlyvalueinlist) { found=true; } else found=false; } else { test=middlevalueinlist; if(valueequaltestvalue) { found=true; } else if(valuelessthantestvalue) { found=BinarySearch(value,listvaluesprecedingtest); } else found=BinarySearch(value,listvaluesfollowingtest); } returnfound; }

2of35