March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Administrative: do you want another lab?Administrative: do you want another lab? Notes on 11Notes on 11 Fundamentals of procedural programmingFundamentals of procedural programming Walking through 11Walking through 11 Making a subroutine/procedure/method/...Making a subroutine/procedure/method/...
March R. Smith - University of St Thomas - Minnesota Notes on 11 The point is to do numeric format conversionThe point is to do numeric format conversion –BY HAND, not by relying on other software Wanted to get numbers we could calculate withWanted to get numbers we could calculate with –Not what you get by converting from text decimal to text binary Good programs are READABLEGood programs are READABLE –I didn’t push this much because I didn’t give you formatting standards
March R. Smith - University of St Thomas - Minnesota Procedural Programming What are the 6 things we do in a program?What are the 6 things we do in a program?
March R. Smith - University of St Thomas - Minnesota Procedural Programming What are the 6 things we do in a program?What are the 6 things we do in a program? –Declare variables –Assignment statements –Call subroutines/procedures/functions/methods –Arithmetic formulas –If statements –Loops
March R. Smith - University of St Thomas - Minnesota Let’s walk through 11 DeclarationsDeclarations InitializationsInitializations Set up the loopSet up the loop Do the loopDo the loop Print the resultPrint the result
March R. Smith - University of St Thomas - Minnesota Next Assignment Accumulate several typed-in numbersAccumulate several typed-in numbers Print the accumulated resultPrint the accumulated result Need a function to read in the numberNeed a function to read in the number –Make it variable base/radix Do we want to support hex?Do we want to support hex? –Well, not at first
March R. Smith - University of St Thomas - Minnesota Building the function for 12 Input and output declarationsInput and output declarations Making the variable radix workMaking the variable radix work Awkward loopsAwkward loops
March R. Smith - University of St Thomas - Minnesota That’s it. Questions?Questions? Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.