// this program demonstrate the fixed-point manipulator.
#include <iostream>
#include <limits>
#include <iomanip>
using namespace std;
int main()
{
// variables.
float x = 1;
float y = 1.2345;
float z = 1234.89;
// process
cout << x << "\t | with no manipulators" << "\n" << y << "\n" << z << "\n" << "\n";
cout << fixed;
cout << x << "\t | with manipulator fixed" << "\n" << y << "\n" << z << "\n" << "\n";
cout << setprecision(2);
cout << x << "\t | with manipulator setprecision(2)" << "\n" << y << "\n" << z << "\n" << "\n";
cout << showpoint;
cout << x << "\t | with manipulator showpoint" << "\n" << y << "\n" << z << "\n" << "\n";
cin.ignore(numeric_limits<streamsize>::max(), '\n');
return 0;
}
Thursday, 24 January 2013
program 2-8(54) Demonstrate fixed-point manipulator
08:07
ATEEK
No comments
0 comments:
Post a Comment