Topics discussed in this section:

Slides:



Advertisements
Similar presentations
Topics discussed in this section:
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.
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 5 Function Basics.
CS2422 Assembly Language and System Programming Linking Loader Department of Computer Science National Tsing Hua University.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand basic loop concepts: ■ pretest loops and post-test loops ■ loop.
Visual C++ Programming: Concepts and Projects
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 9 – Income Tax Calculator Application: Introducing.
Computer Systems Nat 4/5 Computing Science Lesson 1: Binary.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand design concepts for fixed-length and variable- length strings ❏
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 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.
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 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.
Dale Roberts 1 Program Control - Algorithms Department of Computer and Information Science, School of Science, IUPUI CSCI N305.
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.
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 Systems Nat 4/5 Computing Science Lesson 1: Binary.
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 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 Objectives ❏ To understand the basic properties and characteristics of external files ❏ To.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the differences between text and binary files ❏ To write programs.
Program Control: Selection Subject: T0016 – ALGORITHM AND PROGRAMMING Year: 2013.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical.
Topic: Programming Languages and their Evolution + Intro to Scratch
Chapter 7 Text Input/Output Objectives
Topics discussed in this section:
Chapter 7 Text Input/Output Objectives
String Concepts In general, a string is a series of characters treated as a unit. Computer science has long recognized the importance of strings, but it.
Statements (6 of 6) A statement causes an action to be performed by the program. It translates directly into one or more executable computer instructions.
Chapter 15 Lists Objectives
Chapter 7 Text Input/Output Objectives
Selection—Making Decisions
The Selection Structure
Chapter 5 Function Basics
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Computer science By/ Midhat Mohiey. Introduction to Programming using C ++ 2.
Topics discussed in this section:
Chapter 6 Repetition Objectives ❏ To understand basic loop concepts:
Chapter 15 Lists Objectives
Topics discussed in this section:
Topics discussed in this section:
And now for something completely different . . .
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.
Regular Grammar.
Unit 1: Introduction Lesson 1: PArts of a java 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.
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Topics discussed in this section:
Test I information.
Topics discussed in this section:
6 – Miracle And “Hello World”
Selection—Making Decisions
Introduction to Computer Science
Chapter 10: Compilers and Language Translation
CS150 Introduction to Computer Science 1
Topics discussed in this section:
Topics discussed in this section:
Structural Program Development: If, If-Else
Presentation transcript:

Topics discussed in this section: 5-3 Multiway Selection In addition to two-way selection, most programming languages provide another selection concept known as multiway selection. Multiway selection chooses among several alternatives. C has two different ways to implement multiway selection: the switch statement and else-if construct. Topics discussed in this section: The switch Statement The else-if Computer Science: A Structured Programming Approach Using C

FIGURE 5-20 switch Statement Syntax Computer Science: A Structured Programming Approach Using C

Demonstrate the switch Statement PROGRAM 5-6 Demonstrate the switch Statement Computer Science: A Structured Programming Approach Using C

Multivalued case Statements PROGRAM 5-7 Multivalued case Statements Computer Science: A Structured Programming Approach Using C

Summary of switch Statement Rules Table 5-5 Summary of switch Statement Rules Computer Science: A Structured Programming Approach Using C

PROGRAM 5-8 Student Grading Computer Science: A Structured Programming Approach Using C

PROGRAM 5-8 Student Grading Computer Science: A Structured Programming Approach Using C

PROGRAM 5-8 Student Grading Computer Science: A Structured Programming Approach Using C

PROGRAM 5-9 Convert Score to Grade Computer Science: A Structured Programming Approach Using C

PROGRAM 5-9 Convert Score to Grade Computer Science: A Structured Programming Approach Using C

PROGRAM 5-9 Convert Score to Grade Computer Science: A Structured Programming Approach Using C

Topics discussed in this section: 5-4 More Standard Functions One of the assets of the C language is its rich set of standard functions that make programming much easier. For example, C99 has two parallel but separate header files for manipulating characters: ctype.h and wctype.h. Topics discussed in this section: Standard Characters Functions A Classification Program Handling Major Errors Computer Science: A Structured Programming Approach Using C

FIGURE 5-25 Classifications of the Character Type Computer Science: A Structured Programming Approach Using C

Classifying Functions continued Table 5-6 Classifying Functions Computer Science: A Structured Programming Approach Using C

Classifying Functions (continued) Table 5-6 Classifying Functions (continued) Computer Science: A Structured Programming Approach Using C

Table 5-7 Conversion Functions Computer Science: A Structured Programming Approach Using C

Demonstrate Classification Functions PROGRAM 5-10 Demonstrate Classification Functions Computer Science: A Structured Programming Approach Using C

Demonstrate Classification Functions PROGRAM 5-10 Demonstrate Classification Functions Computer Science: A Structured Programming Approach Using C