Write a statement for each of the following:

a) Print integer 40000 left justified in a 15-digit field.
b) Read a string into character array variable state.
c) Print 200 with and without a sign.
d) Print the decimal value 100 in hexadecimal form preceded by 0x.
e) 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.
f) Print 1.234 in a 9-digit field with preceding zeros.


a) ```
cout << left << setw( 15 ) << 40000 << '\n';
```
b) ```
cin >> state;
```
c) ```
cout << showpos << 200 << setw( 4 ) << '\n' << noshowpos << 200 << '\n';
```
d) ```
cout << showbase << hex << 100 << '\n';
```
e) ```
cin.getline( charArray, 10, 'p' );
```
f) ```
cout << fixed << showpoint << setw( 9 )
<< setfill( '0' ) << internal << 1.234 << '\n';
```

Computer Science & Information Technology

You might also like to view...

When you first install Docker using the Install-Package cmdlet, what service will start automatically when you restart the computer?

What will be an ideal response?

Computer Science & Information Technology

Ali is researching communication hardware for her Intro to Networking class so that she can write a report for her instructor. Ali reports that there are many benefits to using a network, such as _____.

A. the ability to store files on a USB device B. locating malicious code C. increased autonomy and privacy D. enhanced communications

Computer Science & Information Technology

Communication between end systems is encrypted using a _________ key.

A. session B. master C. permanent D. message

Computer Science & Information Technology

On a chart, the ________ identifies the data series

Fill in the blank(s) with correct word

Computer Science & Information Technology