Hi there,
For completeness, I'll ask you to wrap your code with [co
de][/code] tags - but I gave you the link describing how to do so in another topic.
The reason this won't work is because of this line:
cout << manip << nbr << endl;
First, manip is a function taking an argument, so it should be: manip(cout);
Second, you are returning a reference to the stream, so the cout object thinks you're wanting to print the address of the stream to the screen.
The insertion operator << is actually a member function of ostream: http://www.cplusplus.com/reference/ostream/ostream/operator%3C%3C/
So what actually happens in succession here is:
1 2 3
|
cout.operator<<(manip);
cout.operator<<(nbr);
cout.operator<<(endl);
|
Also, you are using the setf() function not entirely correct: http://www.cplusplus.com/reference/ios/ios_base/setf/
You need to do:
cout.setf(ios::hex, ios::basefield);
Working example: http://coliru.stacked-crooked.com/a/06a5747841345c6b
All the best,
NwN