I am having problems storing floating point numbers from a random number generator. I can store it once but its when i have to iterate it that the problem comes in.
I have to cut that randomly generated number at the 3rd, 4th, 5th and 6th decimal. Then store it as I go in a variable and lastly have it add up to show the accumulated total through iterations. I have to do 10, 100, 1,000 and 10,000 reps. I am just trying to make the method and then pass the randomly generated number as an argument. I am just having a problem getting the total without actually showing all the work. Its like the variable will be out of scope I think.
Your truncation should be outside of your main method body. I don't see where you are totaling your numbers and if you are trying to keep a running total your function should probably be returning a value instead of being void.
Joined: Oct 07, 2011
I thought void was just to let me make the method ?_?. Wait wait wait...so I need something like
Should it be like that? But I thought you could only return one thing. But I need to return the sums of the 3th, 4th, 5th and 6th. Like as it accumulates the 3th decimal numbers should be adding with the newly found 3th decimal and the 4th should do the same and so on.