Use a stream manipulator that causes the exponent in


Question: (Write a C++ Statement) For each of the following, write a single statement that performs the indicated task.

a) Output the string "Enter your name: ".

b) Use a stream manipulator that causes the exponent in scientific notation and the letters in hexadecimal values to print in capital letters.

c) Output the address of the variable my String of type char *.

d) Use a stream manipulator to ensure that floating-point values print in scientific notation.

e) Output the address in variable integerPtr of type int *.

f) Use a stream manipulator such that, when integer values are output, the integer base for octal and hexadecimal values is displayed.

g) Output the value pointed to by floatPtr of type float *.

h) Use a stream member function to set the fill character to '*' for printing in field widths larger than the values being output.

Repeat this statement with a stream manipulator.

i) Output the characters 'O' and 'K' in one statement with ostream function put.

j) Get the value of the next character to input without extracting it from the stream.

k) Input a single character into variable char Value of type char, using the istream member function get in two different ways.

l) Input and discard the next six characters in the input stream.

m) Use istream member function read to input 50 characters into char array line.

n) Read 10 characters into character array name. Stop reading characters if the '.' delimiter is encountered. Do not remove the delimiter from the input stream. Write another statement that performs this task and removes the delimiter from the input.

o) Use the istream member function gcount to determine the number of characters input into character array line by the last call to istream member function read, and output that number of characters, using ostream member function write.

p) Output 124, 18.376, 'Z', 1000000 and "String", separated by spaces.

q) Print the current precision setting, using a member function of object cout.

r) Input an integer value into int variable months and a floating-point value into float variable percentage Rate.

s) Print 1.92, 1.925 and 1.9258 separated by tabs and with 3 digits of precision, using a stream manipulator.

t) Print integer 100 in octal, hexadecimal and decimal, using stream manipulators and separated by tabs. u) Print integer 100 in decimal, octal and hexadecimal separated by tabs, using a stream manipulator to change the base.

v) Print 1234 right justified in a 10-digit field.

w) Read characters into character array line until the character z; is encountered, up to a limit of 20 characters (including a terminating null character). Do not extract the delimiter character from the stream.

x) Use integer variables x and y to specify the field width and precision used to display the double value 87.4573, and display the value.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Use a stream manipulator that causes the exponent in
Reference No:- TGS02405860

Now Priced at $10 (50% Discount)

Recommended (98%)

Rated (4.3/5)