I was about to ask this question, and found a few more to ask.
How (according to the top answer) would I then proceed to only display this precision for a single call to cout, and then disable it thereafter?
Say I want to show precision for the first three calls, but not the last:
(I named a variable with the same name as the "fixed" format specifier in order to experiment)
#include <iostream>
int main(){
   using namespace std;
   int spam = 5;
   double flak = 5.0;
   double result = spam * flak;
   double fixed = 42;
   cout.precision(1);
   cout << std::fixed << spam + flak << endl;
   cout << result << endl;
   cout << flak << endl;
   cout << fixed;
   return 0;
}
 
     
     
     
    