fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. char *toString(unsigned int value, unsigned int radix)
  5. {
  6. char digit[] = "0123456789ABCDEFGHIJKLMNOPRSTUVWXYZ";
  7. char stack[32];
  8. static char out[33];
  9.  
  10. int quot, rem;
  11. int digits = 0;
  12.  
  13. do
  14. {
  15. quot = value / radix;
  16. rem = value % radix;
  17.  
  18. stack[digits] = digit[rem];
  19. value = quot;
  20. digits++;
  21. }
  22. while( value );
  23.  
  24. int i = 0;
  25. while(digits--)
  26. {
  27. out[i++] = stack[digits];
  28. }
  29.  
  30. out[i] = 0;
  31.  
  32. return out;
  33. }
  34.  
  35. int main()
  36. {
  37. cout << "start" << endl;
  38. cout << toString(4294967295,16) << endl;
  39. cout << "end" << endl;
  40. // your code goes here
  41. return 0;
  42. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
start
FFFFFFFF
end