Sunday 25 August 2013


C++ Program to Demonstrate setprecision Manipulator

Code:
/*C++ Program to Demonstrate setprecision Manipulator*/
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main(void)
{
float a=5,b=3;
clrscr();
float c=a/b;
cout << setprecision(1) <<" c = " << c << endl;
cout << setprecision(2) <<" c = " << c << endl;
cout << setprecision(3) <<" c = " << c <<endl;
cout << setprecision(4) <<" c = " << c <<endl;
cout << setprecision(5) <<" c = " << c <<endl;
getch();
}

Sample Output:

Comment bellow for your Query and Feedback

Related Posts :



0 comments:

Confused? Feel free to ask

Post a Comment