KEEPING CONTROL - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

KEEPING CONTROL

Description:

Nested Loops & Break Statement ... BREAK & SWITCH ... When a break statement is encountered in a switch statement body, it transfers ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 43
Provided by: engineeri67
Category:
Tags: control | keeping | break

less

Transcript and Presenter's Notes

Title: KEEPING CONTROL


1
KEEPING CONTROL
  • Chapter 6
  • 6A

2
REQUEST FOR PROPOSAL
3
REQUEST FOR PROPOSAL RFP
  • Group Project RFP due Friday
  • COVER PAGE -
  • GROUP NAME
    (Consulting Team writing Proposal)
  • COMPANY NAME (Requesting Proposal)
  • GROUP MEMBERS
  • Project Title
  • 1 PAGE COMPANY BACKGROUND
  • 1 PAGE PROBLEM STATEMENT

4
RFP-COVERPAGE
  • COMPANY NAME (Requestor)
  • PROJECT TITLE
  • GROUP NAME (Consulting Team)
  • GROUP MEMBERS

5
RFP-COMPANY BACKGROUND
  • INDUSTRY
  • HISTORY
  • ORGANIZATION STRUCTURE
  • PRODUCTS/SERVICES
  • LOCATIONS
  • WEB-SITE
  • (1 Page)

6
RFP-PROBLEM STATEMENT
  • NEED Statement
  • Process / Business Flow
  • DESIRED INPUTS
  • DESIRED OUTPUTS

7
Identify Plan Activities
  • Types of Activities
  • systems development tasks
  • product components (work breakdown structure)
  • control gates
  • Types of Schedules
  • performance
  • personnel
  • budget
  • Key Issues
  • depth of analysis? how many?
  • controllability
  • Risk management
  • accountability

8
Basic Vee Model
Demonstrate (to Users) and Validate System
Requirements Specification
System Specification and Verification Plan
Integrate and Verify System
Configuration Item Specifications and
Verification Plans
Assemble and Verify Configuration Items
Build to Documentation and Verification
Procedures
Inspect to Build to Documentation
Assembling and Coding
9
Nested Loops Break Statement
  • In the case of a nested loops,
    a break statement would only break out of the
    closest loop.
  • It does not break out of the whole nested
    formation.

10
Break Statement
  • The break statement can also be used in
    conjunction with the switch statement.
  • The break statement can be used to control which
    statements are executed.

11
Break Statement
  • When a switch statement is executed and a
    match is found between the control
    expressions and the constant expressions,
    all of the
    following statements are executed by default.

12
BREAK SWITCH
  • In some cases, we dont want statements in all
    the case labeled statements to be executed when a
    match is found.
  • The break statement can be used to control which
    statements are executed.

13
BREAK SWITCH
  • When a break statement is encountered in a switch
    statement body,
    it transfers control to the statement immediately
    following the switch statement.

14
BREAK SWITCH
  • Switch ( expr )
  • case expr1 statement 1
  • case expr2
  • statement 2
  • break
  • case expr3 statement 3
  • default statement_default
  • next_statement

15
Return Statement
  • When it is executed, it causes control to pass
    from the function back to the position where it
    was called.
  • Function --- where was called

16
Return Statement
  • It could be used to provide a
    point of exit
    from a function
    other than at the end of the
    function block or to allow a function to return a
    value.
  • EXIT from any place

17
RETURN STATEMENT
  • The return statement is used to terminate
    execution of a function.
  • If the function type is void than use
  • return
  • For any legal expression use the format
  • return expression

18
EXIT ( ) LIBRARY FUNCTION
  • The exit ( ) function is available in the library
    on many implementations of C.
  • This function provides a drastic means of
    altering the programs flow of control.
  • When executed, exit ( ) causes the program to
    terminate.
  • Control is returned to the underlying operating
    system.

19
EXIT
  • The exit ( ) function takes a single parameter of
    type int.
  • exit ( 0 )
  • exit ( 1 )
  • exit (255)
  • 0 is normal program termination
  • 1 - 255 different reasons for termination

20
(No Transcript)
21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
Return - Exit
  • The return statement causes control to pass back
    to the calling function.
  • The exit ( ) library function causes program
    termination from any function from which it is
    called.

25
GOTO Statement
  • The goto statement in C allows transfer of
    control from one position in a function to
    another statement in the same function
  • The destination statement must be marked with a
    label.
  • goto identifier

26
LABEL
  • A label in C is an identifier.
  • It must be associated with a statement by using
    the following syntax
  • label statement

27
(No Transcript)
28
(No Transcript)
29
MISUSE of GOTO
  • Indiscriminate use of the goto statement is one
    deterrent to structured programming.
  • Structure of a program
  • Unreliable code
  • Jump into the middle of a block
  • the local variable is not guaranteed to be
    initialized properly when the block is not
    entered from the top.
  • The value could be garbage.

30
RECURSION
  • Recursion occurs when a function or subprogram
    calls itself or calls a function which in turn
    calls the original function.
  • n! n x (n-1)!
  • Starting value for n must be given
  • Recursive functions tend to use a lot of memory.

31
THINGS TO REMEMBER
32
Header Files
  • Ctype.h
  • for character typing

33
Library Functions
  • Exit ( )
  • causes termination of its program

34
Other Utilities
  • Isdigit ( )
  • returns 1 if its argument is a digit
  • 0 otherwise

35
THINGS TO REMEMBER
  • Every do-while loop will execute at least one
    time.
  • The values in the case labeled statements must be
    constant integral expressions.
  • When the switch statement finds a match in one of
    the case values, control is passed to that case
    labeled statement and execution continuous from
    that point in the program.

36
THINGS TO REMEMBER
  • Both the continue and the
  • break statement work with
  • for
  • do-while
  • while loop
  • The break statement is also used with the switch
    statement.

37
THINGS TO REMEMBER
  • When a continue or break statement is used in a
    set of nested loops,
  • it only applies to one loop,
  • the innermost loop that contains the
  • break or continue.

38
THINGS TO REMEMBER
  • The return statement transfers execution control
    our of a function and back to the calling
    environment.
  • When the return statement is used with an
    expression, the expression determines both the
    value and the type of function using it.

39
THINGS TO REMEMBER
  • A return statement can be used to provide more
    than one point of termination of a function.
  • The parameter to exit ( ) can be used to signal
    the reason for program termination. A value of 0
    traditionally means normal termination. Other
    values can be chosen to represent various error
    conditions.

40
THINGS TO REMEMBER
  • When used in main ( )
  • the statement return expression
  • is equivalent to the statement
  • exit (expression)

41
THINGS TO REMEMBER
  • The goto statement is used to transfer control to
    some labeled statement in the same function.
  • It cannot transfer control out of a function.
  • The goto statement is a deterrent to structured
    programming.
  • Its use should be reserved for deeply nested code.

42
THINGS TO REMEMBER
  • Recursion occurs when a function or subprogram
    calls itself or calls another function that
    causes the original function to be called.
  • Recursion can be used to implement recurrence
    relations.
  • Algorithms using recurrence tend to use more
    memory than iterative algorithms.
Write a Comment
User Comments (0)
About PowerShow.com