l4ever 发表于 2019-3-11 12:43:23

多维数组计数的问题

#include <Array.au3>

dim $arr
$arr = 'abc'
$arr = '6'
$arr = 'bcd'
$arr = '5'
$arr = 'cde'
$arr = '5'
$arr = 'def'
$arr = '5'
$arr = 'efg'
$arr = '6'
$arr = 'efg'
$arr = '6'
$arr = 'fgh'
$arr = '5'
$arr = 'ghi'
$arr = '5'

_ArrayDisplay($arr)

如何统计出列子里面6下面的5数量.并和前面一个6进行对应呢?

gyp2000 发表于 2019-3-12 00:47:18


Dim $arr
$arr = 'abc'
$arr = '6'
$arr = 'bcd'
$arr = '5'
$arr = 'cde'
$arr = '5'
$arr = 'def'
$arr = '5'
$arr = 'efg'
$arr = '6'
$arr = 'efg'
$arr = '6'
$arr = 'fgh'
$arr = '5'
$arr = 'ghi'
$arr = '5'
$s = ""
$M = ""
For $i = 0 To UBound($arr) - 1
      If $arr[$i] = "5" Then
                If $s = "" Then $M = $i
                $s += 1
      Else
                If $s And $M Then
                        $arr[$M - 1] = $s
                EndIf
                $s = ""
                $M = ""
      EndIf
Next
If $s And $M Then
      $arr[$M - 1] = $s
EndIf
_ArrayDisplay($arr)

zmdzhxj 发表于 2019-10-19 09:49:44

怎么提示错误:“_ArrayDisplay($arr)”是未知函数?

zmdzhxj 发表于 2019-10-19 10:09:13

不好意思,没看清少了个#include <Array.au3>{:1_518:}
页: [1]
查看完整版本: 多维数组计数的问题