(Ensoul Chee) writes:
> I used
> #include <iostream.h>
This header is deprecated, use #include <iostream>
> int m;
> cout << "Hexadecimal == 0x" << hex << m << endl;
>
> to print value of m in hexadecimal mode.
>
> But I got the compile error like this
>
> couttest.cpp:20 `hex' undeclared (first use this function)
>
> What's wrong with the code?
Everything from the standard library lives in the std:: namespace,
so you have to use the prefix std:: or an using declaration/directive.
The following example should work:
#include <iostream>
int main() {
int m = 13;
std::cout << "Hexadecimal == 0x" << std::hex << m << std::endl;
return 0;
}
HTH & kind regards
frank
--
Frank Schmitt
4SC AG phone: +49 89 700763-0
e-mail: frank DOT schmitt AT 4sc DOT com