如何计算阵列的平均值?(How do I calculate the average of an array?)
Public Class Form1 Dim x As Integer Dim y(9) As Double Dim average As Double Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load For x = 0 To 9 y(x) = x Next average = y(9) / 10 Label1.Text = average End Sub End Class
我在计算0到9数组的平均值时遇到了问题,我意识到我的代码只会计算9除以10,如何继续计算10个数的平均值?
Public Class Form1 Dim x As Integer Dim y(9) As Double Dim average As Double Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load For x = 0 To 9 y(x) = x Next average = y(9) / 10 Label1.Text = average End Sub End Class
I'm having trouble trying to calculate the average of 0 to 9 array, I realize that my code is only going to calculate 9 divided by 10, How do I proceed with calculating the average of the 10 numbers?
原文:https://stackoverflow.com/questions/37272389
最满意答案
首先,我想提请您注意,使用业务或流程变量来存储已存储在外部数据库中的数据将导致重复。 建议的解决方案是使用REST API扩展(例如REST API SQL数据源 )来查询外部数据库中的数据,并在表单中使用此REST API扩展。
现在,如果您可以复制数据,可以参考我创建的示例 ,演示如何使用PostgreSQL连接器输出设置流程和业务数据,然后在表格窗口小部件中显示变量。
我强烈建议使用业务变量,如果可能,请考虑将数据从外部数据库迁移到业务数据数据库。
First of all I want to draw your attention that using business or process variables to store data already stored in an external database will lead to duplication. Recommended solution would be to use a REST API extension (such as REST API SQL data source) to query the data from the external database and use this REST API extension in the forms.
Now if you are ok with duplication of data you can refer to an example I create that demonstrate how to set process and business data with PostgreSQL connector output and then display the variables in form table widgets.
I highly recommend to use business variable and if possible consider migrating the data from the external database to the business data database.
相关问答
更多-
TCP/IP模型是一个________。[2023-05-19]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
SQL局部变量(SQL Local Variable)[2022-12-18]
这应该告诉你你到底需要什么: http : //msdn.microsoft.com/en-us/library/aa259186(v = sql.80).aspx this should tell you exactly what you need: http://msdn.microsoft.com/en-us/library/aa259186(v=sql.80).aspx -
局部变量与实例变量同名=意外的结果(Local variable with same name as instance variable = unexpected results)[2023-11-21]
如果我快速观察实例变量,它也具有“测试”的值。 当我播放到Page_Load时,实例变量的值为null。 你没有看到实例变量,你会看到局部变量。 实例变量从不设置,因为本地作用域变量在作用域生存期内隐藏实例变量。 从规格: 3.7.1名称隐藏 实体的范围通常包含比实体的声明空间更多的程序文本。 具体而言,实体的范围可能包括声明,其中引入了包含同名实体的新声明空间。 这些声明导致原始实体隐藏起来 。 相反,一个实体在没有隐藏时被认为是可见的。 名称隐藏发生在范围通过嵌套重叠并且范围通过继承重叠时发生。 以下部 ... -
为什么局部变量?(Why do local variable?)[2022-03-09]
因为您的查询(Where(...))没有被执行。 我假设过滤器是从循环中获得的? Linq查询在使用之前不会执行。 因此,如果您通过一堆过滤器循环然后开始执行它们,则查询中的过滤器值将是错误的。 类似的问题: 访问Modified Closure还: http : //devnet.jetbrains.net/thread/273042 需要看到更多代码才能100%肯定。 Because your query(Where(...)) is not being executed. I assume filte ... -
自从IDEA 6以来,GUI Designer没有多大变化。我将从内置的帮助系统或其在线副本开始 。 GUI Designer didn't change much since IDEA 6. I'd start with the built-in help system or its online copy.
-
对于这个问题抱歉,情况如下: UI设计者插件目前尚未开发,并且与AppCode 2016.1不兼容。 最近我们发现有关UI设计人员的一些帮助资源已经过时并使我们的用户感到困惑,因为现在所有这些资源都是最新的。 该插件本身因兼容性原因被保留,并且不能与AppCode 2016.1一起使用 Sorry for this issue, situation is the following: UI designer plugin is currently not in active development and ...
-
当你有一个检索操作时,我发现动词被忽略了。 您需要传递的只是具有您要搜索的字段值的BO。 I found out that the verb is ignored, when you have a retrieve operation. All you have to pass is the BO with the field values you want to search for.
-
在你的第一个例子中: 你的外部i不是“全局变量”,它是一个实例属性(有时称为实例变量)。 第一个示例中的代码有效,因为当您使用非限定符号时,会选择范围最窄的符号。 (声明“最接近”使用它的代码。)因此, Something构造函数中的不合格i是i参数,您必须使用this来访问您的实例字段。 JLS§6.5.6.1中的 Gory详细信息: 简单表达式名称 。 如果没有范围较窄的标识符,则可以省略this. 访问字段(和方法),但不存在具有较窄范围的冲突标识符时。 例: class Example { ...
-
首先,我想提请您注意,使用业务或流程变量来存储已存储在外部数据库中的数据将导致重复。 建议的解决方案是使用REST API扩展(例如REST API SQL数据源 )来查询外部数据库中的数据,并在表单中使用此REST API扩展。 现在,如果您可以复制数据,可以参考我创建的示例 ,演示如何使用PostgreSQL连接器输出设置流程和业务数据,然后在表格窗口小部件中显示变量。 我强烈建议使用业务变量,如果可能,请考虑将数据从外部数据库迁移到业务数据数据库。 First of all I want to dra ...