fono Posted October 25, 2004 Share Posted October 25, 2004 well, i want a C++ function that can convert number from decimal to hexadecimal thanks in advance Link to comment Share on other sites More sharing options...
0 kjordan2001 Posted October 25, 2004 Share Posted October 25, 2004 char *itoa( int value, char *string, int radix ); where value is your decimal value, string is where the hex value will be stored, and radix is 16. Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted October 25, 2004 Share Posted October 25, 2004 well, i want a C++ function that can convert number from decimal to hexadecimalthanks in advance 584804123[/snapback] You can also specify the base when you output to a stream. #include <iostream> using namespace std; int main() { int val = 25; string shex; hex(cout); cout << val << endl; dec(cout); cout << val << endl; cout << oct << val << endl; cout << dec << val << endl; return 0; } Link to comment Share on other sites More sharing options...
Question
fono
well, i want a C++ function that can convert number from decimal to hexadecimal
thanks in advance
Link to comment
Share on other sites
2 answers to this question
Recommended Posts