Hi,
I need a program to pick a random number between two values.
Like:
int randomnumber;
0< ramdomnumber <10;
cout<<randomnuber;<<endl;
Thanks
Hi,
I need a program to pick a random number between two values.
Like:
int randomnumber;
0< ramdomnumber <10;
cout<<randomnuber;<<endl;
Thanks
I.. think this is what your asking for...
Code:/* Prints out Random numbers only from 0 - 10, no more, no less.........................*/ #include "iostream.h" #include "stdlib.h" int main() { cout << "\nRandom Number(s)"; cout << "\n---------------------------"; /* Print 20 random numbers, numbers can only be 0 - 10....................*/ for(int idx = 0; idx < 20; idx++) { int i = rand() % 10; // Look here. cout << "\n i equals : " << i << " :"; } cout << "\n\n"; return 0; }
I hope that you were joking. Look through the FAQ before you post.