Simple question - I have a piece of code to generate 3 random numbers and an array containing 3 elements. How can I pass the numbers into the elements of the array? Code would be useful here thanks!
int x; // your random number<br>int y[3]; // your array<br><br>// generate your randon number here<br>.<br>.<br>.<br><br>int Inc = 0; // for array<br><br>y[Inc] = x;<br>Inc++;<br><br>// generate next randon number here<br>.<br>.<br>.<br><br>y[Inc] = x;<br>Inc++;<br><br>// generate next randon number here<br>.<br>.<br>.<br><br>y[Inc] = x;<br>Inc++;<br><br> Of course you really should put bound checks on <i>Inc</i>. If this isn't what you are looking for, give us some more details.<br> <p>James P. Cottingham<br><a href=mailto: > </a><br><a href=
2ffat, the information you gave was what I needed thankyou, but during the number generation what do I need to put to assign the value to the 'x' variable?<br>Thanks for your help!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.