Transformers and More @ The Seibertron Store

Details subject to change. See listing for latest price and availability.
{
srand((unsigned)time(0));
float lowest=-10, highest=10;
float range=(highest-lowest)+1;
for(float index=0; index<8; index++){
rw1 = lowest+float(range*rand()/(RAND_MAX + 100));
cout << setprecision(2) << setiosflags(ios::fixed);
cout << endl;
system ("pause");
}
for(float index=0; index<8; index++){
rw1 = lowest+float(range*rand()/(RAND_MAX + 100));
for (float index=0; index<8; index++){
randomArray[index] = lowest+float(range*rande()/RAND_MAX + 100);
Psycho Warrior wrote:for this reason, that is why I like to be around Locust. fun stuff happens.
Fender Bender wrote:Damn, I learned C++ and Java a year and a half ago and forgot most of it. Hence why I'm not a programmer anymore.
Psycho Warrior wrote:for this reason, that is why I like to be around Locust. fun stuff happens.
The Happy Locust wrote:funny, looks like that code isn't printing anything.
Okay, the easiest way to store the random numbers is either in an array or a linked list.
the current code:
- Code: Select all
for(float index=0; index<8; index++){
rw1 = lowest+float(range*rand()/(RAND_MAX + 100));
updated code
- Code: Select all
for (float index=0; index<8; index++){
randomArray[index] = lowest+float(range*rande()/RAND_MAX + 100);
just make an array of whatever number of objects you need and save the random number directly to it. Obviously, you need to create the array first. hope that helps.
Registered users: AdsBot [Google], Bing [Bot], Bumblevivisector, Cheetron, Glyph, Google [Bot], Google Adsense [Bot], Google Feedfetcher, kuhlio, MSN [Bot], Silver Wind, Yahoo [Bot], Zordon