全文预览

范德蒙行列式用vb编程计算

上传者:幸福人生 |  格式:doc  |  页数:2 |  大小:0KB

文档介绍
j)) - Val(arrayString(i))) Next jРNext iРReturn sumРEnd FunctionРРSub Main()РDim array(100) As IntegerР'获取用户输入,测试数据用,隔开РDim arrayString() = Split(InputBox("请输入数据,用,隔开"), ",") Dim result = calc(arrayString)РMsgBox(result)РEnd SubРРEnd ModuleРModule Module1РРDim sum As IntegerРFunction calc(ByVal arrayString As Object) As IntegerРDim arrayCount As IntegerР'计算数组长度РarrayCount = UBound(arrayString) - LBound(arrayString) + 1Р'定义计算结果Рsum = 1Р'利用双重循环计算范德蒙多行列式值РFor i = 0 To arrayCount - 1РFor j = i + 1 To arrayCount - 1Р'Val 函数转字符串为整数Рsum *= (Val(arrayString(j)) - Val(arrayString(i))) Next jРРРРРNext iРReturn sumРEnd FunctionРРSub Main()РDim array(100) As IntegerР'获取用户输入,测试数据用,隔开РDim arrayString() = Split(InputBox("请输入数据,用,隔开"), ",") Dim result = calc(arrayString)РMsgBox(result)РEnd SubРРEnd Module

收藏

分享

举报
下载此文档