For each of the following, write a statement that would display the indicated output. Assume that # means space. Do not use quoted strings in your statements. For part (c), left-justify the string in a field of 10 columns.


int n = 25;
int m = 2;
int p = 573;
double x = 55.2583;
double y = -77.314;
string str = "Fred";



a. ###25
##2#####573
b. ####55.26
#-77.314
c. Fred######2


a.


cout << setw( 5 ) << n << endl << setw( 3 ) << m << setw( 8 )
<< p << endl;

b.

cout << setiosflags( ios::fixed ) <<
setprecision( 2 ) << setw( 9 ) << x << endl <<
setprecision( 3 ) << setw( 8 ) << y << endl;

c.

cout << setiosflags( ios::left ) << setw( 10 ) << str << m << endl;

Computer Science & Information Technology

You might also like to view...

To create a variable that is an array, you drag the array. . . control into the editing area.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Answer the following statements true (T) or false (F)

1. Names that are defined outside of a namespace are part of the unnamed namespace 2. In a program with no user defined namespaces, all names are defined in the global namespace 3. The global namespace and the unnamed namespace are the same. 4. Classes must always be defined in separate files 5. ADTs should be defined and implemented in separate files

Computer Science & Information Technology

When you apply effects to artwork, ____.

A. you can still modify the original artwork B. you cannot modify the original artwork until you remove the effects C. you can change their order in the Appearance panel D. both a. and c.

Computer Science & Information Technology

Which aggregate function returns a count of all non-null values returned by a value expression?

a. COUNT(*) b. COUNT(value expression) c. SUM(value expression) d. MAX(value expression)

Computer Science & Information Technology