Which of the following sets of statements will set floating point output to the stream outStream to fixed point with set 3 places of decimals? In the explanation, you must give any necessary #include directives and using directives or declarations.

a. outStream.setf(ios::fixed);
outStream.setf(ios::showpoint);
outStream.precision(2);
b. outStream.setf(ios::fixed | ios::showpoint);
outStream << setprecision(2);
c. outStream << setflag(ios::fixed);
outStream << setflag(ios::showpoint);
outStream << setprecision(2);
d. outStream.flags(ios::fixed);
outStream.flags(ios::showpoint);
outStream.precision(2);

a) and b) work if you #include and give either using namespace std; using std::ios; or using std::precision; using std:ios;
Explanation: c) is an incorrect use of manipulators and non-manipulators. d) is a misuse of the flags member function.

Computer Science & Information Technology

You might also like to view...

Output reports should be designed

a. With the developer in mind. b. With the user in mind. c. As fast a possible, without consideration of where data really needs to be place. d. All of the above.

Computer Science & Information Technology

Which of the following common principles of design model methodologies is sometimes referred to as divide and conquer?

A. Cohesion B. Coupling C. Decomposition D. Encapsulation

Computer Science & Information Technology