三九宝宝网宝宝百科宝宝知识

VB由程序随机产生一个6 6的二维数组输出数组中的最大元素

12月25日 编辑 39baobao.com

[关于用SUMPRODUCT取代SUM数组公式的想法]用过数组公式的都可能知道,考试大提示对于多条件求和或计数,我们一般都采用这种数组公式来计算。如:对于1个明细数据(见例),我们需要求该班男、女生各科成绩大于各科平均分的人...+阅读

'vb6 测试成功

Option Explicit

Private Function max(b() As Integer) As Integer

Dim i As Integer

Dim j As Integer

For i = 1 To 6

For j = 1 To 6

If max < b(i, j) Then max = b(i, j)

Next

Next

End Function

Private Function mul(c() As Integer) As Double

Dim i As Integer

Dim j As Integer

Dim max As Integer

Dim max_r As Integer

max = c(1, 1)

max_r = 1

For i = 1 To 6

For j = 1 To 6

If max < c(i, j) Then

max = c(i, j)

max_r = i

End If

Next

Next

mul = 1

For j = 1 To 6

mul = mul * c(max_r, j)

Next

End Function

Private Sub Command1_Click()

Cls

Dim a(1 To 6, 1 To 6) As Integer

Dim i As Integer

Dim j As Integer

Randomize

For i = 1 To 6

For j = 1 To 6

a(i, j) = Int(Rnd * (100 - 10 + 1) + 10)

Print a(i, j); Tab(8 * j);

Next

Print

Next

Print "max = "; max(a())

Print "mul = "; mul(a())

Open App.Path & "\output.txt" For Output As #1

For i = 1 To 6

For j = 1 To 6

Print #1, a(i, j); Tab(j * 8);

Next

Print #1,

Next

Print #1, "max = "; max(a())

Print #1, "mul = "; mul(a())

Close #1

End Sub

以下为关联文档:

数据结构教程第二十二课实验五数组实验教学目的: 掌握二维数组的实现方法教学重点: 二维数组的存储表示,二维数组的基本操作教学难点: 二维数组的基本操作授课内容:数组的顺序存储表示和实现:#include#define M...

二维类间方差阈值分割的快速迭代算法【摘要】 传统的二维Otsu阈值分割算法采用穷举搜索法搜寻阈值向量。与此不同,本文提出了一种二维类间方差阈值分割的快速迭代算法,用迭代的思想解决原始二维Otsu方法计算复杂...

先从键盘输入26个字母生成无序数组数组排序再从键盘输入一个#include <stdio.h> #include <string.h> #define N 50 int Find(char* arr, int size, char n) { int pos; int upper = size - 1; int lower = 0; while (upper - lower >...

在perl语言下怎么对散列的数组按其中的三个散列值排序然后再按顺#!/usr/bin/perl my a = ( { name =>'banan', class =>1, score =>45 }, { name =>'tommy', class =>2, score =>35 }, { name =>'tommy', class =>2, score =>22 }, { name...

perl排序一个数组其中每组数含有8个数字按照其中某个数字大小import java.io.*;import java.util.*;public class ArraySortDemo { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedRead...

按键精灵分割一篇文章分割符号 R然后对分割出来的奇数数组展开全部 Function Spl_Odd(Int) Spl_Odd="":Te = Split(Int, "R") For itemp = 0 To Ubound(Te) Step 2 Spl_Odd=Spl_Odd&Te(iTemp)&"RR" Next Spl_Odd = Left(Spl_Odd, Len(Spl_...

按键精灵数组的问题。求指教!高手进你返回的out是数组da的最大下标 大写 = "A|B|C|D|E|F|G|" 小写 = "a|b|c|d|e|f|g|" da = Split(大写, "|") xiao = Split(小写, "|") For i = 0 To UBound(da)-1 text = text & da(i) & xi...

按键精灵问题在循环中重新搞一个新的数组VBS Randomize a=INT((5-1)*RND+1) For i = 1 To a VBS Randomize c = INT((10 - 1) * RND + 1) d = d & "|" & c Next TracePrint d b = split(Right(d, len(d) - 1), "|") For...

推荐阅读
图文推荐