What happens when you attempt to compile and run the following code?

Last Updated on December 5, 2021 by Admin 2

What happens when you attempt to compile and run the following code?

#include <iostream>
#include <iomanip>

using namespace std;

int main ()
{
float f = 10.126;
cout.unsetf(ios::floatfield);
cout<<showpoint<<f<<fixed<<” “<<setprecision(2)<<f<<endl;
return 0;
}

Program outputs:

  • 10.126 10
  • 10.126 10.12
  • 10.1260 10.13
  • 10.126 10.13
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments