formating - cout << setw(7) << wholeValu; cout...

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

View Full Document Right Arrow Icon
// filename: formating.cpp // author: j.dzuback // modified: / /* The program uses field width and precision manipulators to format numeric data for reporting */ #include <iostream> #include <iomanip> # using namespace std; const int WHOLE_NUM = 1215; const float REAL_NUM = 3.35988F; c int main () { float realValu; int wholeValu; cout << fixed << showpoint; wholeValu = WHOLE_NUM + REAL_NUM; realValu = float(WHOLE_NUM) + REAL_NUM; cout << WHOLE_NUM << endl; cout << wholeValu << 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: cout << setw(7) << wholeValu; cout << setw(7) << wholeValu << setw(7) << wholeValu /10 << endl; cout << setw(7) << realValu << endl; cout << setprecision(10) << realValu << endl; cout << setw(7) << setprecision(3) << realValu << endl; cout << realValu << endl; cout << wholeValu << setw(3) << wholeValu << setw(7) << wholeValu << endl; cout << endl << endl << "*** end of formating ***" << endl; return 0; }...
View Full Document

This note was uploaded on 02/08/2011 for the course CSC 101 taught by Professor Joedzuback during the Spring '11 term at Union County.

Ask a homework question - tutors are online