Exponent Output

Hey!
I want to know how to output numbers in exponent. with cout<<scientifix<<100.0; it works. But if i:
1
2
 int x=100;
cout<<scientific<<x;
It doesnt. Thanks for your help.
The x is int. The 100.0 is double. You can static_cast.
std::scientific only has an effect on floating-point numbers (float or double).

What you could do is to change x to double
1
2
double x = 100;
cout << scientific << x;
or cast x to a double before printing it.
1
2
int x = 100;
cout << scientific << static_cast<double>(x);
Thank both of you.
Topic archived. No new replies allowed.