VB:
Private Sub Command1_Click()
Randomize
Dim Arr(1 To 6) As Integer
For i = 1 To 6
Arr(i) = Int(Rnd * 1000)
Print Arr(i);
Avg = Avg + Arr(i)
Next i
Print "平均值:" & Avg / 6
End Sub
C++:
#include
#include
using namespace std;
int main()
{
setlocale(0,"chs");
srand(time(0));
int a[5],i,sum=0;
double avg;
for(i=0;i