Set width and precision in iostream of STD
1. Call precision and width close to cout;
2. fixed to enforce to show a float as 23.45 format
int nLine = 1; for ( int i = 0; i < 100; i += 5)
{
cout.precision( 2); cout.width( 6);
cout << fixed << inch2cm( i) << " ";
if ( nLine % 10 == 0)
{ cout << endl; }
nLine++;
}
2. fixed to enforce to show a float as 23.45 format
int nLine = 1; for ( int i = 0; i < 100; i += 5)
{
cout.precision( 2); cout.width( 6);
cout << fixed << inch2cm( i) << " ";
if ( nLine % 10 == 0)
{ cout << endl; }
nLine++;
}
1 Comments:
At 8:31 PM , Anonymous said...
...please where can I buy a unicorn?
Post a Comment
Subscribe to Post Comments [Atom]
<< Home