Hi
i have a program that shows up random numbers here is the code that does this
at the moment i get duplicate numbers. how can i get the program to check each number and if it is the same change it to another one so there are no duplicate numbers?Code:#include <iostream> #include<cstdlib> #include <ctime> using namespace std; int main () { srand((unsigned)time(NULL)); int Rand[10]={0}; for(int i=0;i<10;++i) { Rand[i]=rand()%11+1; cout<<Rand[i]<<endl; } cin.get(); }
Thanks