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.

Slides:



Advertisements
Similar presentations
Topics discussed in this section:
Advertisements

Computer Science: A Structured Programming Approach Using C Memory Allocation Functions C gives us two choices when we want to reserve memory locations.
Computer Science: A Structured Programming Approach Using C Converting File Type A rather common but somewhat trivial problem is to convert a text.
CS 106 Introduction to Computer Science I 02 / 27 / 2008 Instructor: Michael Eckmann.
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Program Design Divide and Conquer –Divide the program into separate tasks Functional Decomposition Top-Down Design –Divide an overall problem into discrete.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Solve for y when x = 1, 2, 3 and 4. 1.) y = x ) y = 5x 4 3.) y = 3x Solve for y when x is -2, -1, 0, 1. Patterns and Functions Day 2.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define 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.
Chapter 7 Software Engineering Objectives Understand the software life cycle. Describe the development process models.. Understand the concept of modularity.
Engineering 1020 Introduction to Programming Peter King Winter 2010.
Top-Down Design and Modular Development
Computer Science: A Structured Programming Approach Using C A Programming Example— Morse Code Morse code, patented by Samuel F. B. Morse in 1837,
Computer Science: A Structured Programming Approach Using C1 6-9 Recursion In general, programmers use two approaches to writing repetitive algorithms.
Procedures and Functions Computing Module 1. What is modular programming? Most programs written for companies will have thousands of lines of code. Most.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 2.
Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have.
Chapter 10 Software Engineering. Understand the software life cycle. Describe the development process models. Understand the concept of modularity in.
CMSC 104, Version 8/061L17Top-DownDesign.ppt Top-Down Design Topics Top-Down Design Top-Down Design Examples The Function Concept Reading Sections 3.1.
Computer Science: A Structured Programming Approach Using C1 5-3 Multiway Selection In addition to two-way selection, most programming languages provide.
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.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have.
1 Objectives ❏ To design and implement programs with more than one function ❏ To be able to design multi-function programs ❏ To understand the purpose.
2.1 Functions. Functions in Mathematics f x y z f (x, y, z) Domain Range.
Computing Higher – SD Unit - Topic 8 – Procedure and Standard Algorithms P Lynch, St Andrew’s High School Unit 2 Software Development Process Topic.
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.
1 UMBC CMSC 104, Section Fall 2002 Functions, Part 1 of 3 Topics Top-down Design The Function Concept Using Predefined Functions Programmer-Defined.
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.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical.
CIT 590 Intro to Programming Lecture 2. Questions regarding enrollment The cap is still in effect The course will be offered again in the spring The waitlist.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
CMSC 104, Version 8/061L16IncrementalProg.ppt Incremental Programming Topics Review of Incremental Programming Example of Incremental Programming Reading.
Section 9.4 – Solving Differential Equations Symbolically Separation of Variables.
Introduction to the C Language
Functions Review.
Selection—Making Decisions
Software Design and Development
Topics discussed in this section:
Chapter 8 Arrays Objectives
Topics discussed in this section:
Chapter 9 Pointers Objectives
Introduction to the C Language
3-7 Sample Programs This section contains several programs that you should study for programming technique and style. Computer Science: A Structured.
Topics discussed in this section:
Topics discussed in this section:
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
Subroutines and Functions
Chapter 8 Arrays Objectives
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
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.
Week 4 Lecture-2 Chapter 6 (Methods).
See requirements for practice program on next slide.
Topics discussed in this section:
Chapter 8 Arrays Objectives
Section 9.4 – Solving Differential Equations Symbolically
Introduction to C++ Programming Language
Topics discussed in this section:
Presentation transcript:

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. Scope pertains to any object that can be declared, such as a variable or a function declaration. Global Scope Local Scope Topics discussed in this section:

Computer Science: A Structured Programming Approach Using C2 FIGURE 4-32 Scope for Global and Block Areas

Computer Science: A Structured Programming Approach Using C3 Variables are in scope from declaration until the end of their block. Note

Computer Science: A Structured Programming Approach Using C4 It is poor programming style to reuse identifiers within the same scope. Note

Computer Science: A Structured Programming Approach Using C5 4-7 Programming Example— Incremental Development Top–down development, a concept inherent to modular programming, allows us to develop programs incrementally. By writing and debugging each function separately, we are able to solve the program in smaller steps, making the whole process easier. First Increment: main and getData Second Increment: add Final Increment: Print ResultsThe Topics discussed in this section:

Computer Science: A Structured Programming Approach Using C6 FIGURE 4-33 Calculator Program Design

Computer Science: A Structured Programming Approach Using C7 PROGRAM 4-13Calculator Program—First Increment

Computer Science: A Structured Programming Approach Using C8 PROGRAM 4-13Calculator Program—First Increment

Computer Science: A Structured Programming Approach Using C9 PROGRAM 4-13Calculator Program—First Increment

Computer Science: A Structured Programming Approach Using C10 PROGRAM 4-14Calculator Program—Second Increment

Computer Science: A Structured Programming Approach Using C11 PROGRAM 4-14Calculator Program—Second Increment

Computer Science: A Structured Programming Approach Using C12 PROGRAM 4-14Calculator Program—Second Increment

Computer Science: A Structured Programming Approach Using C13 PROGRAM 4-14Calculator Program—Second Increment

Computer Science: A Structured Programming Approach Using C14 PROGRAM 4-15Calculator Program—Final Increment

Computer Science: A Structured Programming Approach Using C15 PROGRAM 4-15Calculator Program—Final Increment

Computer Science: A Structured Programming Approach Using C16 PROGRAM 4-15Calculator Program—Final Increment

Computer Science: A Structured Programming Approach Using C17 PROGRAM 4-15Calculator Program—Final Increment

Computer Science: A Structured Programming Approach Using C Software Engineering In this section we discuss three different but related aspects of software engineering design: the structure chart, functional cohesion, and top–down development. Structure Charts Structure Chart Rules Functional Cohesion Top–Down Development Topics discussed in this section:

Computer Science: A Structured Programming Approach Using C19 FIGURE 4-34 Structure Chart Symbols

Computer Science: A Structured Programming Approach Using C20 FIGURE 4-35 Structure Chart Design

Computer Science: A Structured Programming Approach Using C21 Structure charts show only function flow; they contain no code. Note

Computer Science: A Structured Programming Approach Using C22 FIGURE 4-36 Common Functions in a Structure Chart

Computer Science: A Structured Programming Approach Using C23 Table 4-1Structure Chart Rules

Computer Science: A Structured Programming Approach Using C24 FIGURE 4-37 Calculate Taxes Design

Computer Science: A Structured Programming Approach Using C25 FIGURE 4-38 Design For Print Report

Computer Science: A Structured Programming Approach Using C26 PROGRAM 4-16Top–down Development Example

Computer Science: A Structured Programming Approach Using C27 PROGRAM 4-16Top–down Development Example

Computer Science: A Structured Programming Approach Using C28 PROGRAM 4-16Top–down Development Example