- You might think that the defaultneeds to go at the bottom of the switchstate-
 ment, but this isn’t true. The defaultcan go anywhere. There is a problem, how-
 ever. There should be a breakstatement at the end of the defaultcase.
- The code is as follows:
 if( choice == 1 )
 printf(“You answered 1”);
 else if( choice == 2 )
 printf( “You answered 2”);
 else
 printf( “You did not choose 1 or 2”);
- The code is as follows:
 do {
 / any C statements /
 } while ( 1 );
Answers for Day 14
Quiz
- A stream is a sequence of bytes. A C program uses streams for all input and out-
 put.
- a. A printer is an output device.
 b. A keyboard is an input device.
 c. A modem is both an input and an output device.
 d. A monitor is an output device. (Although a touch screen would be an input
 device and an output device.)
 e. A disk drive can be both an input and an output device.
- All C compilers support three predefined streams:stdin(the keyboard),stdout
 (the screen), and stderr(the screen). Some compilers, also support stdprn(the
 printer), and stdaux(the serial port COM1). Note that the Macintosh doesn’t sup-
 port the stdprnfunction.
- a.stdout
 b.stdout
 c.stdin
 d.stdin
 e.fprintf()can use any output stream. Of the five standard streams, it can use
 stdout,stderr,stdprn, andstdaux.
864 Appendix F49 448201x-APP F 8/13/02 11:22 AM Page 864
