0

I have an equation within a while loop like this:

```
while(repeats != 1000000){
x = rand1;
y = rand2;
result = x + y;
cout << result;
repeats++;
}
```

Basically, 2 numbers are randomly generated, and are added together to put in the variable 'result'. What the above does is print 1000000 values for result. What I want to do is store every value and take an average at the end, to get an average of the results it gives me.

Any ideas?

Thanks!