I looked at bits/ostream_insert.h:
template
basic_ostream<_CharT, _Traits>&
__ostream_insert(basic_ostream<_CharT, _Traits>& __out,
const _CharT* __s, streamsize __n)
...
const bool __left = ((__out.flags()
& __ios_base::adjustfield)
here is the corrected code and my comments:
#include
using namespace std;
int main(void) {
cout.fill(' '); //justification fill character
cout.width(4); //4 characters justified before decimal point
cout.precision(2); //2 digits after decimal point
cout.flags(ios::dec|ios::fixed|io
I discovered in some debugging I was just doing that floatfield is NOT
something you want to set if you want any usable output.
out.flags(ios::dec|ios::fixed|ios::right|ios::showpoint);
is better.
when I use printf, %4.2 gives me the output I want: everything to left of
decimal point right j
2012/3/10 Jim Michaels
> #include
> using namespace std;
> int main(void) {
> cout.fill(' ');
> cout.width(6);
> cout.precision(2);
> cout.flags(ios::fixed|ios::floatfield|ios::right);
> cout<<15.91D;
> return 0;
> }
> expected output:
> 15.91
> actual output:
> 15.91
>
that should have been cout.width(4);
#include
using namespace std;
int main(void) {
cout.fill(' ');
cout.width(4);
cout.precision(2);
cout.flags(ios::fixed|ios::floatfield|ios::right);
cout<<15.91D;
return 0;
}
expected output:
15.91
actual output:
15.91
http://www.
Hello,
I've been trying to compile a 64bits version of MySQL Connector/C
(libmysql version 6.0.2)
Since the source archives at dev.mysql.com do not compile
straighforward, decided to use LuaDist version instead:
https://github.com/LuaDist/libmysql
Now, after fulling OpenSSL and ZLib dependencie
#include
using namespace std;
int main(void) {
cout.fill(' ');
cout.width(6);
cout.precision(2);
cout.flags(ios::fixed|ios::floatfield|ios::right);
cout<<15.91D;
return 0;
}
expected output:
15.91
actual output:
15.91
http://www.cplusplus.com/reference/iostream/ios_b
On 8.3.2012 23:58, JonY wrote:
> On 3/9/2012 05:12, Teemu Nätkinniemi wrote:
>> G:/MinGWx64/msys/1.0/src/stellarium/src/core/StelTexture.hpp:27,
>>from
>> g:/MinGWx64/msys/1.0/src/stellarium/plugins/Satellites/src/Satellite.cpp:26:
>> g:\cbad\mingw64\bin\../lib/gcc/x86_64-w64-mi