Exercises

  1. 13.6 (Write C++ Statements) Write a statement for each of the following:

    1. Print integer 40000 left justified in a 15-digit field.

    2. Read a string into character array variable state.

    3. Print 200 with and without a sign.

    4. Print the decimal value 100 in hexadecimal form preceded by 0x.

    5. Read characters into array charArray until the character 'p' is encountered, up to a limit of 10 characters (including the terminating null character). Extract the delimiter from the input stream, and discard it.

    6. Print 1.234 in a 9-digit field with preceding zeros.

  2. 13.7 (Inputting Decimal, Octal and Hexadecimal Values) Write a program to test the inputting of integer values in decimal, octal and hexadecimal formats. Output each integer read by the program ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.