Advertisement

ArrayFilling

Started by July 05, 2002 09:54 PM
0 comments, last by ShadowGlance 22 years, 5 months ago
Stupid question, how do you fill an array using the fubction rand() with the values 1-11?? thx for the help!!!!!!!! "I bow to no one and give service only to cause"
"I bow to no one and give service only to cause"
This might be one way:


  for (int i=0; i<100; ++i) arr[i] = (rand()*11)/RAND_MAX + 1;    


[edited by - turnipo on July 5, 2002 11:10:48 PM]
--------------------------Why are you driving like a hammerhead?

This topic is closed to new replies.

Advertisement