Exercises
-
13.6 (Write C++ Statements) Write a statement for each of the following:
Print integer
40000
left justified in a 15-digit field.Read a string into character array variable
state
.Print
200
with and without a sign.Print the decimal value
100
in hexadecimal form preceded by0x
.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.Print
1.234
in a 9-digit field with preceding zeros.
-
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.