In class we have been learning to convert decimal to Binary, octal, and now Hexadecimal. I've been working on a program that does all the converting for you, but so far only have decimal->binary, and decimal->octal. I have no idea how to take up decimal->hexadecimal because of the 1-9 and a-f. Take a look at my format an what not so far;
Code:
That's what I have so far. I'm still a noob programmer, so I don't think everything is "optimized". Any ideas on how to add hexadecimal?
Code:
:Lbl 1
:4->X
:17->Y
:ClrHome
:Input "DECIMAL: ",D
:D->C
:Output(3,1,"Binary
:While D>0
:Y-1->Y
:fPart(D/2)->F
:iPart(D/2)->D
:If F=.5
:Then
:Output(X,Y,"1
:Else
:Output(X,Y,"0
:End:End
:Output(5,1,"OCTAL
:X+2->X
:17->Y
:While C>0
:Y-1->Y
:fPart(C/8)->F
:iPart(C/8)->C
:F(8)->F
:Output(X,Y,F
:End
:Pause
:Goto1
That's what I have so far. I'm still a noob programmer, so I don't think everything is "optimized". Any ideas on how to add hexadecimal?