Chapter3 - Engineering Problem Solving with C+,...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Engineering Problem Solving with C++, Second Edition, J. Ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 3 Control Structures Prof. Xin Wang (xwang@ece.sunysb.edu) Office: 235 Light Engineering building Class time: TuTh 3 :50 pm 5:10 pm Office Hour: Tu : 10 am- 12:00 am TA: Shekhar B Sastry ( ssastry@ic.sunysb.edu) Wednesday: 2:00pm ~ 4:00pm Friday: 2:00am ~ 4:00pm Control structures ± Algorithm Development ± Conditional Expressions ± Selection Statements ± Repetition Statements ± Structuring Input Loops Engineering Problem Solving with C++, Second Edition, J. Ingber 2 ALGORITHM DEVELOPMENT Structured Programming Evaluation of Alternative Solutions Engineering Problem Solving with C++, Second Edition, J. Ingber 3 Algorithm Development ± An algorithm is a sequence of steps for solving a problem. ± Engineering problem solutions to real world problems require complex algorithms. ± Development of a good algorithm increases the quality and maintainability of a solution, and reduces the overall time required to implement a correct solution. Engineering Problem Solving with C++, Second Edition, J. Ingber 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Top-Down Design ± Top-down design begins with a "big picture" description of a problem solution in sequential steps. ± The sequential steps are refined until the steps are detailed enough to translate to language statements. ± The refined steps, or algorithm, can be described using pseudo code or flowcharts. Engineering Problem Solving with C++, Second Edition, J. Ingber 5 Evaluation of Alternative Solutions ± Most problems have more than one solution. ± There may not be a single best solution, but some solutions are better than others. ± Elements that contribute to a good solution: correctness reliability readability maintainability execution speed memory considerations user interface Engineering Problem Solving with C++, Second Edition, J. Ingber 6 Structured Programming ± A structured program is written using simple control structures, including: Sequence – steps are performed one after another. Selection – one set of statements is executed if a given condition is true, a different set of statements, or no statements at all, is executed if the condition is false. Repetition – A set of statements is executed repeatedly as long as a given condition is true. Engineering Problem Solving with C++, Second Edition, J. Ingber 7 Engineering Problem Solving with C++, Second Edition, J. Ingber 8 Structured Programming ± Sequence ± Selection ± Repetition ? true false ? true false ? => conditional expression
Background image of page 2
CONDITIONAL EXPRESSIONS Relational operators Logical operators Engineering Problem Solving with C++, Second Edition, J. Ingber 9 Conditional Expressions ± A conditional expression is a Boolean expression that evaluates to true or false.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/23/2011 for the course ECE 224 taught by Professor Wangxin during the Spring '09 term at SUNY Stony Brook.

Page1 / 13

Chapter3 - Engineering Problem Solving with C+,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online