{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Chapter18solutions

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

Info icon This 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 The variable input is not updated with a value as the input stream does not match the format string.
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern