高中十六進(jìn)制轉(zhuǎn)二進(jìn)制vb程序 VB中的八進(jìn)制怎么算?
VB中的八進(jìn)制怎么算?5乘5=25,八進(jìn)制每8進(jìn)1,尾數(shù)是答案的最后一個(gè)數(shù)字1,十進(jìn)制,尾數(shù)大于5,十六進(jìn)制是9代碼:private sub command1uuuux()dim x as longx
VB中的八進(jìn)制怎么算?
5乘5=25,八進(jìn)制每8進(jìn)1,尾數(shù)是答案的最后一個(gè)數(shù)字1,十進(jìn)制,尾數(shù)大于5,十六進(jìn)制是9代碼:private sub command1uuuux()
dim x as long
x=Val(InputBox(“請(qǐng)輸入十進(jìn)制數(shù):”)
print“轉(zhuǎn)換為八進(jìn)制的結(jié)果是”,str(DEC~OCT(x))
End Sub
公共函數(shù)DEC~OCT(DEC As Long)作為字符串
DEC~OCT=“”
Do While DEC> 0
DEC~OCT=DEC Mod 8&;DEC~OCT
DEC=DEC8
循環(huán)
結(jié)束函數(shù)圖:
十進(jìn)制轉(zhuǎn)化為八進(jìn)制的vb代碼?
代碼:privatesubcommand1~Click()dimxaslongx=Val(InputBox()請(qǐng)輸入框()輸入十進(jìn)制數(shù):“”)print“轉(zhuǎn)換成八進(jìn)制的結(jié)果是”,str(DEC ?OCT(x))EndSubPublicFunctionDEC ?OCT(DecAsLong)AsStringDEC ?OCT=“”DoWhileDec>0DEC ?OCT=DecMod8&DEC ?Octdec=DEC8loopendfunction圖: