Fortran95程序设计习题答案第十一章4
Fortran95程序设计习题答案
module vector_utility
implicit none
type vector
real x,y
end type
interface operator(+)
module procedure vector_add_vector
end interface
interface operator(-)
module procedure vector_sub_vector
end interface
interface operator(*)
module procedure real_mul_vector
module procedure vector_mul_real
module procedure vector_dot_vector
end interface
interface operator(.dot.)
module procedure vector_dot_vector
end interface
contains
type(vector) function vector_add_vector(a,b) type(vector), intent(in) :: a,b
vector_add_vector = vector(a%x+b%x, a%y+b%y) end function
type(vector) function vector_sub_vector(a,b) type(vector), intent(in) :: a,b
vector_sub_vector = vector(a%x-b%x, a%y-b%y) end function
type(vector) function real_mul_vector(a,b) real, intent(in) :: a
type(vector), intent(in) :: b
real_mul_vector = vector( a*b%x, a*b%y ) end function
type(vector) function vector_mul_real(a,b) type(vector), intent(in) :: a
real, intent(in) :: b
你可能喜欢
- 程序题
- 阅读程序题
- 设计的程序
- fortran95
- 应用程序
- 第七章 标志设计的程序36页
- 建筑结构设计的程序与方法研究15页
- 产品设计的程序与方法(PPT71)71页
- 第十五章 采区设计的程序和内容29页
- 室内设计的程序与方法论2页
- 交通信号灯自动控制系统设计的程序13页
- fortran95第六章 课后答案4页
- fortran9514页
- fortran95的使用方法918页
- fortran95的使用方法812页
- fortran95的使用方法723页
- fortran95的使用方法621页
- 开发第一个安卓应用程序6页
- 数据分析应用程序3页
- Ch12-小应用程序33页
- 第01章 JSP和web应用程序31页
- 第四章 文件应用程序19页
- 数据分析应用程序6页


