Define function to set cout
#include <iostream> using namespace std; ostream &setsci(ostream &stream) { stream.setf(ios::scientific | ios::uppercase); return stream; } int main() { double f = 123.23; cout << setsci << f; cout << '\n'; return 0; }