ex0513.f90
来自「Fortran95的一些有用的源程序」· F90 代码 · 共 27 行
F90
27 行
program ex0513
implicit none
real a,b,ans
character operator
read(*,*) a
read(*,"(A1)") operator ! 不使用格式有些机器会读不到除号"/"
read(*,*) b
select case(operator)
case('+')
ans = a+b
case('-')
ans = a-b
case('*')
ans = a*b
case('/')
ans = a/b
case default ! 输入其它符号不处理
write(*,"('Unknown operator ',A1)") operator
stop ! 结束程序
end select
write(*,"(F6.2,A1,F6.2,'=',F6.2)") a,operator,b,ans
stop
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?