Convert Alphanumeric to Binary

Jul 7, 2011 at 5:50pm
Hello,
I have a program where a user can input alphanumeric value(e.g. 6A000). Once value is entered I need to make sure that the value is not larger than 524287(decimal).At this point, I am trying to convert the user input to binary and than convert to decimal to see if it is within range. Does anyone know how to convert alphanumeric to binary. I tried bitset but I don't think it is working corretly.
Jul 7, 2011 at 5:53pm
Jul 7, 2011 at 6:25pm
WebJose,
Thanks for the link but it speaks on converting hex(0-9 and A-F) to int. I need something that will convert an alphanumeric value(0-7 and A-Z) to binary or decimal.

Thanks In Advance
Jul 7, 2011 at 7:21pm
alphanumeric can be treated as decimal numbers, so can be converted to binary the same way a hex will get converted.
try it.
Jul 8, 2011 at 1:17am
Thanks,
I am confused, hex numbers consists of 0-9 and A-F, correct? Also, I have no idea how to convert an alphanumeric to binary. By any chance can anyone give an example on converting an alphanumeric to binary.

Thanks Advance
Jul 8, 2011 at 1:45am
Yes hex numbers consist of 0-9 and A-F (also called base 16, 16 different values per digit). Base 10 which most people use is 0-9 (10 different values per digit). Binary which computers use is 0-1 or base 2. I have done encoding in base 36 before which is 0-9 and A-Z if that is what your talking about. You can google on base 36 converter examples.

Note, hex is used as short hand for binary. Each 4 binary bits (a nibble) maps to 1 hex value, easier to read than a bunch of 1's and 0's...
Topic archived. No new replies allowed.