VB中求最大公约数的方法
Private Function gcd(x As Integer, y As Integer) As Integer Dim div As Integer If x < y Then div = x Else div = y End If While div > 1 If x Mod div = 0 And y Mod div = 0 Then gcd = div Exit Function Else div = div - 1 End If Wend gcd = 1 End Function...
VB中角度化为弧度的代码?
const PI=3.14159 '定义常数π,这里取5位小数,可以根据需要修改 Dim an as single,result as signle an=30.303312345 '获得输入值 result = an * PI\/180 ‘按原值计算弧度值,保留所有的小数 Text1.Text = Format(result,"0.000") '输出转换后的值,根据需要设置小数位数,这里是保留3位...