#include <iostream>
using namespace std;
int main()
{
cout.setf(ios_base::fixed, ios_base::floatfield);
float tub = 10.0 / 3.0;
double mint = 10.0 / 3.0;
const float million = 1.0e6;
cout << "tub = " << tub;
cout << " , a million tubs = " << million * tub;
cout << " ,\nand ten million tubs = ";
cout << 10 * million * tub << "\n";
cout << "mint = " << mint << " and a million mint = ";
cout << million * mint << "\n";
return 0;
}
OUTPUT:
tub = 3.333333 , a million tubs = 3333333.250000,
and ten million tubs = 33333332.000000
mint = 3.333333 and a million mint = 3333333.333333
Could someone please clarify what the ios_base::floatfield
argument does...
I get what the other one does... This program was copied out of my book
Please use code tags. See "information" listed the side bar.