Program to illustrate the precision() function


#include <iostream.h>
int main()
{
    float pi = 22.0 / 7.0;
    cout << "The output without setting the precision is : ";
    cout << pi << "\n";
    cout << "The output after setting the precision is : ";
    cout.precision(3);
    cout << pi << "\n";
    cout << "The remaining...\n";
    cout << 6.700912 << "\n";
    cout << 8.900414;
         return 0 ;
}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|