Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have.

Similar presentations


Presentation on theme: "Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have."— Presentation transcript:

1 Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have not formally discussed how we use C facilities to input and output data. We devote two chapters, Chapter 7 and 13, to fully explain the C input/output facilities and how to use them. In this section, we describe simple input and output formatting. Streams Formatting Input/Output Topics discussed in this section:

2 Computer Science: A Structured Programming Approach Using C2 A terminal keyboard and monitor can be associated only with a text stream. A keyboard is a source for a text stream; a monitor is a destination for a text stream. Note

3 Computer Science: A Structured Programming Approach Using C3 FIGURE 2-15 Stream Physical Devices

4 Computer Science: A Structured Programming Approach Using C4 FIGURE 2-16 Output Formatting Concept

5 Computer Science: A Structured Programming Approach Using C5 FIGURE 2-17 Output Stream Formatting Example

6 Computer Science: A Structured Programming Approach Using C6 FIGURE 2-18 Conversion Specification

7 Computer Science: A Structured Programming Approach Using C7 Table 2-10Format Codes for Output

8 Computer Science: A Structured Programming Approach Using C8 Table 2-11Flag Formatting Options

9 Computer Science: A Structured Programming Approach Using C9 FIGURE 2-19 Formatting Text from an Input Stream

10 Computer Science: A Structured Programming Approach Using C10 FIGURE 2-20 Input Stream Formatting Example

11 Computer Science: A Structured Programming Approach Using C11 FIGURE 2-21 Conversion Specification

12 Computer Science: A Structured Programming Approach Using C12 scanf requires variable addresses in the address list. Note

13 Computer Science: A Structured Programming Approach Using C13 Table 2-12scanf Rules

14 Computer Science: A Structured Programming Approach Using C14 2-8 Programming Examples In this section, we show some programming example to emphasize the ideas and concepts we have discussed about input/output.

15 Computer Science: A Structured Programming Approach Using C15 PROGRAM 2-4A Program That Prints “Nothing!”

16 Computer Science: A Structured Programming Approach Using C16 PROGRAM 2-5Demonstrate Printing Boolean Constants

17 Computer Science: A Structured Programming Approach Using C17 PROGRAM 2-5Demonstrate Printing Boolean Constants (continued)

18 Computer Science: A Structured Programming Approach Using C18 PROGRAM 2-6Print Value of Selected Characters

19 Computer Science: A Structured Programming Approach Using C19 PROGRAM 2-6Print Value of Selected Characters (continued)

20 Computer Science: A Structured Programming Approach Using C20 PROGRAM 2-6 Print Value of Selected Characters (continued)

21 Computer Science: A Structured Programming Approach Using C21 PROGRAM 2-6 Print Value of Selected Characters (continued)

22 Computer Science: A Structured Programming Approach Using C22 PROGRAM 2-7Calculate a Circle’s Area and Circumference

23 Computer Science: A Structured Programming Approach Using C23 PROGRAM 2-7 Calculate a Circle’s Area and Circumference (continued)

24 Computer Science: A Structured Programming Approach Using C24 FIGURE 2-22 Output Specifications for Inventory Report

25 Computer Science: A Structured Programming Approach Using C25 PROGRAM 2-8A Sample Inventory Report

26 Computer Science: A Structured Programming Approach Using C26 PROGRAM 2-8 A Sample Inventory Report (continued)

27 Computer Science: A Structured Programming Approach Using C27 FIGURE 2-23 Complex Number Attributes

28 Computer Science: A Structured Programming Approach Using C28 PROGRAM 2-9Print Complex Number Attributes

29 Computer Science: A Structured Programming Approach Using C29 PROGRAM 2-9 Print Complex Number Attributes (continued)

30 Computer Science: A Structured Programming Approach Using C30 PROGRAM 2-10Complex Number Arithmetic

31 Computer Science: A Structured Programming Approach Using C31 PROGRAM 2-10 Complex Number Arithmetic (continued)

32 Computer Science: A Structured Programming Approach Using C32 PROGRAM 2-10 Complex Number Arithmetic (continued)


Download ppt "Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have."

Similar presentations


Ads by Google