Sunday 8 September 2013

zero-argument manipulator that should work same as hex

Tags

How do I write my own zero-argument manipulator that should work same as hex?

Ans:
This is shown in following program.


#include

ostream& myhex ( ostream &o ) {

o.setf ( ios::hex) ; return o ;

}
void main( ) {

cout << endl << myhex << 2000 ;

}


EmoticonEmoticon