Topics discussed in this section:

Slides:



Advertisements
Similar presentations
Nested if-else Statements.  Should be indented to make the logic clear.  Nested statement executed only when the branch it is in is executed. For example,
Advertisements

Computer Science: A Structured Programming Approach Using C Converting File Type A rather common but somewhat trivial problem is to convert a text.
P449. p450 Figure 15-1 p451 Figure 15-2 p453 Figure 15-2a p453.
2-1 Making Decisions Sample assignment statements PayAmount = Hours * Rate PayAmount = 40*Rate + (Hours – 40)*Rate*1.5.
Expressions and statements Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand basic loop concepts: ■ pretest loops and post-test loops ■ loop.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Computer Science: A Structured Programming Approach Using C Masks In many programs, bits are used as binary flags: 0 is off, and 1 is on. To set.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To be able to use the bitwise logical operators in programs ❏ To be able to use.
Introduction to Computers
Computer Science: A Structured Programming Approach Using C1 6-9 Recursion In general, programmers use two approaches to writing repetitive algorithms.
Computer Science: A Structured Programming Approach Using C1 4-6 Scope Scope determines the region of the program in which a defined object is visible.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To be able to list and describe the six expression categories ❏ To understand.
1 Objectives ❏ To be able to list and describe the six expression categories ❏ To understand the rules of precedence and associativity in evaluating expressions.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical.
Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have.
Computer Science: A Structured Programming Approach Using C1 8-7 Two-Dimensional Arrays The arrays we have discussed so far are known as one- dimensional.
Computer Science: A Structured Programming Approach Using C1 5-3 Multiway Selection In addition to two-way selection, most programming languages provide.
1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical operators: and, or, and not ❏ To understand how a C program.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the structure, union, and enumerated types ❏ To use the type definition.
Computer Science: A Structured Programming Approach Using C1 5-2 Two-Way Selection The decision is described to the computer as a conditional statement.
Computer Science: A Structured Programming Approach Using C1 5-2 Two-Way Selection The decision is described to the computer as a conditional statement.
IB Computer Science – Logic
Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have.
Computer Science: A Structured Programming Approach Using C1 6-6 Loop Examples This section contains several short examples of loop applications. Each.
Computer Science: A Structured Programming Approach Using C1 8-7 Two-Dimensional Arrays The arrays we have discussed so far are known as one- dimensional.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
Computer Science: A Structured Programming Approach Using C1 5-5 Incremental Development Part II In Chapter 4, we introduced the concept of incremental.
Computer Science: A Structured Programming Approach Using C1 5-5 Incremental Development Part II In Chapter 4, we introduced the concept of incremental.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To design and implement programs with more than one function ❏ To be able to.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Topics discussed in this section:
Chapter 12 Enumerated, Structure, and Union Types Objectives
Introduction to the C Language
AND.
Introduction to C++ Programming Language
Functions Review.
Selection—Making Decisions
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Chapter 3 Derivatives.
Introduction to the C Language
Chapter 6 Repetition Objectives ❏ To understand basic loop concepts:
3-7 Sample Programs This section contains several programs that you should study for programming technique and style. Computer Science: A Structured.
Chapter 15 Lists Objectives
Structure of a C Program
Topics discussed in this section:
3-3 Side Effects A side effect is an action that results from the evaluation of an expression. For example, in an assignment, C first evaluates the expression.
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Chapter 4 Functions Objectives
Chapter 14 Bitwise Operators Objectives
Topics discussed in this section:
3-3 Side Effects A side effect is an action that results from the evaluation of an expression. For example, in an assignment, C first evaluates the expression.
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Adding and Subtracting Positive and Negative Numbers
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Topics discussed in this section:
Computer Programming Basics
Selection—Making Decisions
Topics discussed in this section:
Topics discussed in this section:
Chapter 1 Functions.
Introduction to Computers
Presentation transcript:

Topics discussed in this section: 5-5 Incremental Development Part II In Chapter 4, we introduced the concept of incremental development with a simple calculator program. We continue the discussion by adding a menu and calculator subfunctions. Topics discussed in this section: Calculator Design Calculator Incremental Design Computer Science: A Structured Programming Approach Using C

FIGURE 5-26 Design for Menu-driven Calculator Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—First Increment PROGRAM 5-11 Menu-driven Calculator—First Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—First Increment PROGRAM 5-11 Menu-driven Calculator—First Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—First Increment PROGRAM 5-11 Menu-driven Calculator—First Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—First Increment PROGRAM 5-11 Menu-driven Calculator—First Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Third Increment PROGRAM 5-12 Menu-driven Calculator—Third Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Third Increment PROGRAM 5-12 Menu-driven Calculator—Third Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Third Increment PROGRAM 5-12 Menu-driven Calculator—Third Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Third Increment PROGRAM 5-12 Menu-driven Calculator—Third Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Third Increment PROGRAM 5-12 Menu-driven Calculator—Third Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Third Increment PROGRAM 5-12 Menu-driven Calculator—Third Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Third Increment PROGRAM 5-12 Menu-driven Calculator—Third Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Menu-driven Calculator—Fifth Increment PROGRAM 5-13 Menu-driven Calculator—Fifth Increment Computer Science: A Structured Programming Approach Using C

Topics discussed in this section: 5-6 Software Engineering In this section, we discuss some software engineering issues related to decisions. Topics discussed in this section: Dependent Statements Negative Logic Rules for Selection Statements Selection in Structure Charts Computer Science: A Structured Programming Approach Using C

Examples of Poor and Good Nesting Styles PROGRAM 5-14 Examples of Poor and Good Nesting Styles Computer Science: A Structured Programming Approach Using C

Table 5-8 Indentation Rules Computer Science: A Structured Programming Approach Using C

Avoid compound negative statements! Note Avoid compound negative statements! Computer Science: A Structured Programming Approach Using C

Complementing Expressions Table 5-9 Complementing Expressions Computer Science: A Structured Programming Approach Using C

Table 5-10 Selection Rules Computer Science: A Structured Programming Approach Using C

FIGURE 5-27 Structure Chart Symbols for Selection Computer Science: A Structured Programming Approach Using C

FIGURE 5-28 Multiway Selection in a Structure Chart Computer Science: A Structured Programming Approach Using C