I am trying to find the equivalence of %2d using cout << <<endl format. how can I do that?
views:
47answers:
2so I would do:setw (2) fo %2d?
EquinoX
2010-04-16 02:42:29
Yes. cout<<setw(2)<<value<<endl;
codaddict
2010-04-16 02:43:30
+7
A:
The header <iomanip> contains the stream manipuator setw:
cout << setw(2) << myint << endl
You may also be interested in setfill:
cout << setfill('0') << setw(2) << myint << endl
will pad with a 0 instead of a space.
John Ledbetter
2010-04-16 02:42:17