如何平均数组中的数字? [英] How to average numbers from an array?

查看:84
本文介绍了如何平均数组中的数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub btnDisplay_Click(sender As Object,e As System.EventArgs)处理btnDisplay.Click

''计算平均得分并显示结果


Dim intScores()As Integer = {88,72,99,20,66,95,99,100,72,88,78,45,57,89,85,78,75,88,72,88}


这是编程的开始,但我不知道如何继续实现最终结果。我需要找到总数并在消息框中显示数组的平均分数。

Private Sub btnDisplay_Click(sender As Object, e As System.EventArgs) Handles btnDisplay.Click
'' calculates average score and displays the result

Dim intScores() As Integer = {88, 72, 99, 20, 66, 95, 99, 100, 72, 88, 78, 45, 57, 89, 85, 78, 75, 88, 72, 88}

This is the beginning of the programming, but I don''t know how to continue to achieve the end result. I need to find the total and display the average score of the array in a message box.

推荐答案

1)获取数组的长度。

2)数组总值。

3)将总值除以数组长度。


在msgbox中显示结果;您是否需要有关该部分代码的帮助?
1) Get the length of the array.
2) Total the array values.
3) Divide the Total Value by the Array length.

Present results in msgbox; Do you need help with that part of the code?


@C CSR


我的问题是编码,我是混淆如何使用代码来获取结果
@C CSR
My problem is the coding, I am confuse on how to word the codes to obtain the result


使用Access Basic:

Using Access Basic:

展开 | 选择 | 换行 | 行号


这篇关于如何平均数组中的数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆