is there is any fun in the c++ library that takes a dec and return hex

I would think sprintf() is as much C++ as null terminated char arrays are. However, if you don't like using C style I/O and all you want to do is to see the hex equivalent of a value, not manipulate the hex equivalent of a value, then there is a stream flag/modifier by the name of hex that can be used to view the value of a numeric variable as hex as opposed to dec.

>that's c not c++
sprintf is C++ too.

>do u know anyother sol. in c++
Yes, use the hex manipulator with either cout or a string stream. Alternatively, you can do the conversion manually, but since that's available in C as well, I guess it doesn't count as C++. :icon_rolleyes:

This question has already been answered. Start a new discussion instead.