setf_rounding - c double measurement = 567.455678786556...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // class 3 demo 4 #include <iostream> using namespace std int main() { double num = 0.0 cout << "Enter an unrounded number: " cin >> num cout.setf(ios::fixed) cout.precision(2) // rounded to the penny cout << "Rounded, the number is " << num << endl
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c double measurement = 567.455678786556 cout.precision(0) // rounding to whole number cout << measurement << endl c return 0 }// end of main...
View Full Document

This note was uploaded on 04/01/2008 for the course CMPSC 101 taught by Professor Drobish,renee during the Spring '07 term at Penn State.

Ask a homework question - tutors are online