User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 401,973 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,807 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.

Running an equation a million times

Join Date: Jan 2008
Posts: 70
Reputation: andyg55 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
andyg55 andyg55 is offline Offline
Junior Poster in Training

Re: Running an equation a million times

  #2  
Mar 3rd, 2008
ok, instead i did a while loop like this:

while(repeats != 1000000){
Equation = x + y;
Cout << Equation;
repeats++;
}

So basically, it prints the above 1000000 times. Instead, what I want it to do is record every value of x, add them all up, and then divide by 1000000 to get an average. I then want this to be displayed to screen.

Any ideas?
Reply With Quote  
All times are GMT -4. The time now is 6:58 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC