数学中国

 找回密码
 注册
搜索
热搜: 活动 交友 discuz
查看: 90|回复: 1

求数列各项中的最大值或最小值的程序

[复制链接]
发表于 2026-9-23 15:30 | 显示全部楼层 |阅读模式
Private Function max(ByVal lists As String) As String
'取最大值的程序
Dim temp As String
Dim a() As String
a = Split(lists, "/")
Dim B As Long
temp = a(0)
For B = 0 To UBound(a)
If qdfh(temp) < qdfh(a(B)) Then temp = a(B)
Next
max = temp
End Function

Private Function min(ByVal lists As String) As String
'取最小值的程序
Dim temp As String
Dim a() As String
a = Split(lists, "/")
Dim B As Long
temp = a(0)
For B = 0 To UBound(a)
If qdfh(temp) > qdfh(a(B)) Then temp = a(B)
Next
min = temp
End Function
 楼主| 发表于 2026-9-23 15:38 | 显示全部楼层
Private Function max(ByVal lists As String) As String '输出绝对值最大值
Dim temp As String
Dim a() As String
a = Split(lists, "/")
Dim b As Long
temp = a(0)
For b = 0 To UBound(a)
If Abs(temp) < Abs(a(b)) Then temp = a(b)
Next
max = temp
End Function

Private Function mix(ByVal lists As String) As String '输出绝对值最小值
Dim temp As String
Dim a() As String
a = Split(lists, "/")
Dim b As Long
temp = a(0)
For b = 0 To UBound(a)
If Abs(temp) > Abs(a(b)) Then temp = a(b)
Next
mix = temp
End Function
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|数学中国 ( 京ICP备05040119号 )

GMT+8, 2026-10-6 23:49 , Processed in 0.087279 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表