single.bas

来自「82 sample programs written in BASCOM-805」· BAS 代码 · 共 24 行

BAS
24
字号
'---------------------------------------------------------
'                  SINGLE.BAS
'         (c) 1998-2000 MCS Electronics
'---------------------------------------------------------
$large
Dim X As Single , Y As Single , Result As Single
Dim I As Integer
Dim Buf As String * 16
Input "Enter x " , X                                          'ask for 2 values
Input "Enter y " , Y
Print "X+Y=" ; : Result = X + Y : Print Result                'calculate
Print "X-Y=" ; : Result = X - Y : Print Result
Print "X/Y=" ; : Result = X / Y : Print Result
Print "X*Y=" ; : Result = X * Y : Print Result

Buf = Fusing(result , ##.##)                                  'format a string
Print Buf                                                     'print it

Result = 100.1                                                'type converion from single to integer
I = Result : Print I

Result = I                                                    'type conversion from integer to single
Print Result
End

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?