You are obviously learning c++ so stick with the c++ headers please. First the two outputs are exactly the same because you didn't change anything between the two attempts to output jax.
In both the fixed and scientific notations, the precision field specifies exactly how many digits to display after the decimal point, even if this includes trailing decimal zeros. The number of digits before the decimal point does not matter in this case.