Chapter18solutions - Chapter 18 18.1 a. b. c. d. e. 18.2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 18 18.1 a. printf("an integer: %d\n a string: %s\n and a float %f\n", 111, "Eleventy One", 111.11); b. printf("Tel Number :(%d)-%d-%d\n", areaCode, exchange, number); c. printf("ID Number: %s-%s-%s\n", idPart1, idPart2, idPart3); d. scanf("%d-%d-%d",&id1, &id2, &id3); e. scanf("%s ,%s , %c %d %c", first, last, &middle, &age, &sex); 18.2 The return value of scanf is the number of format specifications that were successfully scanned in the input stream. 18.3 So that the user can edit the input stream before hitting enter and thereby confirming the input. 18.4 The program is now forced to wait until new input is added into the input stream, for example by the user typing at the keyboard. 18.5 The %d format specification causes printf to output the next parameter (in this case the value of x, which happens to be a floating point number) as an integer value. In this case, the bit pattern for x is interpreted as an integer. 18.6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/07/2008 for the course ECE 495K taught by Professor Vijaykumar during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 6

Chapter18solutions - Chapter 18 18.1 a. b. c. d. e. 18.2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online