TITLE: Stream manipulators for oct and hex PROBLEM: freeman@orville.psu.edu (Art Freeman) Error messages: t.cxx:18: error: In this statement, "ch" is of type "char", and may not be converted to "ios". t.cxx:19: error: In this statement, "ch" is of type "char", and may not be converted to "ios". Compilation terminated with errors. Program listing: 15 char ch = alpha[i]; 16 cout << '\'' << ch << '\'' 17 << " = " << int(ch) 18 << " = 0" << oct(ch) 19 << " = 0x" << hex(ch) << '\n'; RESPONSE: steve@taumet.com (Steve Clamage), 8 Feb 93 Your problem is that 'oct' and 'hex' are defined in as manipulators: ios& oct(ios&); ios& hex(ios&); With no other declarations visible, the compiler must try to convert the char argument to ios&, which can't be done. You may be trying to use the old-style (C++ 1.3) formatting functions char* oct(long, int=0); char* hex(long, int=0); which are not always supplied with current C++ implementations. You can get the effect you want like this: << oct << int(ch) << hex << int(ch) Bear in mind that the conversion base of the stream is changed by the manipulators and remains until explicitly changed again. You could add cout << dec; to restore the decimal base, or use the setf() functions.