Hi, I'm trying to make a program in c++ that will random 7 numbers every time I open the application..
I'm experiencing some problems. I need the program to make all the 7 numbers different, an they actually are sometimes, but sometimes it happens that 2 number of 7 repeats, for example:
2
4
13
18
13
19
31
- please help me if you can..
ps. here's my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int main(int argc, char *argv[])
{
int x;
srand(time(NULL));
rand();
for (x=1;x<8;x=x+1)
{
int rnd=rand() %39+1;
cout<< rnd<<endl;
}
system("PAUSE");
return 0;
}