![]() |
Need some ideas on making a Bin/Dec/Hex converter.
Hi, i am new in Go4Expert and i need some ideas on making a Bin/Dec/Hex converter(in C++)...
the main problems are: 1. when accessing an intger it's not possible to go over every digit it has like in arrays, you can have a char array: char arr[10]="Hello"; and the array is really "H", "e", "l", "l", "o"... 2. when you declare a intger array: int arr[10]; you can't input a number such as "10011011" and the int array will be "1", "0", "0", "1", "..." and so on, to do so you can do a For loop, but then you have to input each number separately and this becomes a huge probelm with binary numbers such as "100101100011110111" and longer... there are more problems but if one of these two are not solved there is no point going forward... thanks in advance. |
Re: Need some ideas on making a Bin/Dec/Hex converter.
Welcome to G4EF.
Regarding your problem you can do is get the binary number in the character array. Something like Code:
char arr[10]="10011011" |
Re: Need some ideas on making a Bin/Dec/Hex converter.
Good idea, i never thought of typecasting arrays...
|
| All times are GMT +5.5. The time now is 11:31. |