c++: use same output format