Can anyone help me out with this, b v.greatful. I'm trying to convert a given int to a binary number. I can output the data by dividing the num by 2 each time, e.g
10/2 = 0
5/2 = 1
2/2 = 0
1/2 =1
Program outputs 0101, but this has to be revesed so 1010. any ideas? Please!!!
void DecBinary(short int Num1)
{
short int Temp,Answer=0;
asm
{
mov ax,Num1;
mov Temp,ax;
Binary:
mov Answer,0;
mov bx,2;
xor ax,ax;
mov ax,Temp;
div bl;
mov bl,al //get whole no out of al
mov Temp,bx;
cmp ah,0;
jz NotNum;
jmp Next;
NotNum:
inc Answer;
}
asm
{
Next:
}
cout << Answer;
asm
{
cmp Temp,0;
jne Binary;
}
}