what's the difference

look at cout.setf(ios_base::fixed, ios_base::floatfield)
and cout<<setprection<<fixed.

I'm just giving an example , I want to know what's the difference between those two ?

1
2
  cout.setf(ios_base::fixed, ios_base::floatfield);
cout<<setprecision()<<fixed;
The second one doesn't compile because std::setprecision expects one argument

As for std::cout << std::fixed;, it is the same as std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield); by definition
Last edited on
oh thank you , so it's the same assuming I included " using namespace std; " in the function?
Topic archived. No new replies allowed.