80 likes | 183 Views
ENGR 330: Today’s Class. Administrative: do you want another lab? Notes on 11 Fundamentals of procedural programming Walking through 11 Making a subroutine/procedure/method/. Notes on 11. The point is to do numeric format conversion BY HAND, not by relying on other software
E N D
ENGR 330: Today’s Class • Administrative: do you want another lab? • Notes on 11 • Fundamentals of procedural programming • Walking through 11 • Making a subroutine/procedure/method/... R. Smith - University of St Thomas - Minnesota
Notes on 11 • The point is to do numeric format conversion • BY HAND, not by relying on other software • Wanted to get numbers we could calculate with • Not what you get by converting from text decimal to text binary • Good programs are READABLE • I didn’t push this much because I didn’t give you formatting standards R. Smith - University of St Thomas - Minnesota
Procedural Programming • What are the 6 things we do in a program? R. Smith - University of St Thomas - Minnesota
Procedural Programming • What are the 6 things we do in a program? • Declare variables • Assignment statements • Call subroutines/procedures/functions/methods • Arithmetic formulas • If statements • Loops R. Smith - University of St Thomas - Minnesota
Let’s walk through 11 • Declarations • Initializations • Set up the loop • Do the loop • Print the result R. Smith - University of St Thomas - Minnesota
Next Assignment • Accumulate several typed-in numbers • Print the accumulated result • Need a function to read in the number • Make it variable base/radix • Do we want to support hex? • Well, not at first R. Smith - University of St Thomas - Minnesota
Building the function for 12 • Input and output declarations • Making the variable radix work • Awkward loops R. Smith - University of St Thomas - Minnesota
That’s it. • 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 http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. R. Smith - University of St Thomas - Minnesota