作者Hydrisk (小辛苦)
看板Yup00-02
標題Fortran程式(物體在斜面上)
時間Mon May 17 09:34:49 2004
program homework
implicit none
real :: angle,force,time,mass,rad
real :: Vx,Vy,Vt,distance
write(*,*)'請輸入角度'
read(*,*)angle
write(*,*)'請輸入所施的力'
read(*,*)forve
write(*,*)'請輸入時間'
read(*,*)time
write(*,*)'請輸入質量'
read(*,*)mass
subroutine Angle_TO_Rad( angle, rad )
implicit none
real angle, rad
real, parameter :: pi=3.14159
rad = angle*pi/180.0
return
end
subroutine Get_Speed( angle, rad, force, time, mass, Vx, Vy, Vt, distance)
implicit none
real, parameter :: G=9.81
call Angle_TO_Rad( angle, rad )
Vx = (force - mass*G*sin(rad))*time*cos(rad)/mass
Vy = (force - mass*G*sin(rad))*time*sin(rad)/mass
Vt = (force - mass*G*sin(rad))*time/mass
distance = (force - mass*G*sin(rad))*t**2/2*mass
return
end
call Get_Speed( angle, rad, force, time, mass, Vx, Vy, Vt, distance)
write(*,*)'水平速度為',Vx
write(*,*)'垂直速度為',Vy
write(*,*)'最終速度為',Vt
write(*,*)'位移為',distance
stop
end
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.136.202.133