Section 6.2 Member Functions and Precision
A function that is associated with a certain type of object is called a member function of that object. You have already used member functions
setf(...)
and precision(...)
for formatting our output streams using cout
. These functions are included briefly below:
// Use cout's member function "set flags", called setf // The argument here means to use a fixed point rather than scientific notation cout.setf(ios::fixed); // Use cout's setf function again, but this time // The argument tells cout to show the decimal point cout.setf(ios::showpoint); // Use cout's member function, called Precision // The argument indicated to display 2 digits of precision cout.precision(2);
You have attempted 1 of 1 activities on this page.