5. 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);
7.To clear the show plus sign flag but leave the rest of the
flags alone, you use the _____________ member function and
argument.
e) setf(! ios::showpos);
f) setprecision(ios::showpos);
g) unsetf(ios::showpos);
h) setf(ios::showneg);
i) unsetf(! ios::showneg);
8.To determine whether a file was opened successfully, one can
use the ___________ fstream member function
j) close( )
k) overloaded operator <<( )
l) open( )
m) eof( )
n) flush( )
9-The ____________ fstream member function closes a file stream.
Explain why it is best to close a file when the program is through
processing the data in the file.
o) close( )
p) overloaded operator <<( ) open( )
q) eof( )
r) flush( )
10-The _______ member function takes a single char value from
the input file, without regard to whether it is whitespace.
s) newLine
t) get
u) put
v) getline
w) putline
5. Which of the following sets of statements will set floating point output to the stream outStream to fixed point with
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
5. Which of the following sets of statements will set floating point output to the stream outStream to fixed point with
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!