Thread: Base Converter
View Single Post
  #2 (permalink)  
Old July 9th, 2008, 07:44 PM
Old Pedant Old Pedant is offline
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Code:
int[] element = new int[10];
int num = #a89ef; // or use decimal 690671
for ( int i = 0; i < 10; ++i )
{
    element[i] = num % 10;
    num /= 10;
}
I'm not a C# person, so if minor syntax error apologies. But concept works for 32 bit integers, which can't exceed 10 decimal digits. Doesn't handle negative numbers.
Reply With Quote
The Following User Says Thank You to Old Pedant For This Useful Post:
iceman90289 (February 5th, 2009)