setprecision and setw - 2nd example

/*This program will demonstrate how to  
display significant digits using setprecision 
and field widths with setw*/

#include <iostream.h> //cin and cout
#include <iomanip.h> // setw , setprecision, unsetf

main()
{
	float x = 3.2;
	float y = 2.45678;
	
	cout << x << '\n';
	cout << y << '\n';
	cout << "**********\n";
	
	//activating decimal display
	cout.setf(ios::showpoint);
	
	//Below sets a field of 8 with 4 significant digits
	cout << setprecision (4) << setw(8)<< x << '\n';
	cout << "**********\n";
	
	cout << setprecision (5) << setw(7) << y << '\n';
	cout << "**********\n";
	
	cout << x << '\n';
	cout << y << '\n';
	cout << "**********\n";
	
	//deactivating decimal display. 
        cout.unsetf(ios::showpoint);

	cout << x << '\n';
	cout << y << '\n';

return 0;
}
/*
Below is the output
  
3.2
2.45678
**********
   3.200
**********
 2.4568
**********
3.2000
2.4568
**********
3.2
2.4568
*/