I need to create a code that converts any binary number (up to 8 digits) into the decimal counterpart.
So i have created most of the program but i have one problem, this is that i have used a ToCharArray to split the string of numbers entered into the individual elements of an array. But then i have to use them number for arithmetic, - but for that they need to be in an integer array.
Dim array(7) As Integer
Dim num As String
Dim i As Integer = 0
Dim x As Integer = 0
Dim y As Integer = 1
Dim dec As Integer = 0
console.writeline("Enter an 8-Digit binary string")
num = console.readline()
num.ToCharArray(array)
array.Reverse(array)
For i = 0 To 7
dec = dec + array(x) * 1 * y
x = x + 1
y = y * 2
Next
console.write(dec)
console.read()
(Sorry i didn't know which parts would be helpful or not, so heres what ive got so far)