How to output float number with scientific format in C++

1 Answer

0 votes
#include <iostream>
#include <iomanip>

using std::cout;
using std::endl;

int main()
{
	float d = 0.0001234;

	cout << setiosflags(std::ios::scientific) << d << endl;


	return 0;
}


/*
run:

1.234000e-04

*/

 



answered May 26, 2018 by avibootz

Related questions

1 answer 205 views
1 answer 203 views
1 answer 171 views
171 views asked Apr 7, 2018 by avibootz
1 answer 127 views
1 answer 156 views
...