Functions
Functions
Slide 2 Where are we now? now Midterm: structured programming Simple types of variables Array 3 program structures Functions(subprograms) cin(>)/cout(<< (File lO)
Slide 2 Where are we now? Simple types of variables 3 program structures cin(>>)/cout(<<) Array Functions (subprograms) (File I/O) Midterm: structured programming now
Slide 3 Review Problem Solving process le Define and analyze the problem What is the input output? What constraints must be satisfied? 0Eo What information is essential? Design an algorithm What steps must be done? Wirte down the solution steps in detail o05 Implement a program -programming or coding Compile, test, and debug the program -testing Document and maintain the program
Slide 3 Review: Problem Solving Process Define and analyze the problem What is the input & output? What constraints must be satisfied? What information is essential? Design an algorithm What steps must be done? Wirte down the solution steps in detail Implement a program - programming or coding. Compile, test, and debug the program - testing. Document and maintain the program
Slide 4 Top-down analysis A complex problem is often easier to solve by dividing it into several smaller parts ( subproblems), each of which can be solved by itself This is called top-down programming Let's take the example of Diamand drawing
Slide 4 Top-down analysis A complex problem is often easier to solve by dividing it into several smaller parts (subproblems), each of which can be solved by itself. This is called top-down programming. Let’s take the example of Diamand drawing!
Slide 5 Example: Diamond Pattern Input: nothing Output: print out a diamond pattern 大大大 大大大大大 大大大大大大大 大大大大大大大 大大大大大
Slide 5 Example: Diamond Pattern Input: nothing Output: print out a diamond pattern * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *