I am currently trying to create a list of skills and each list of skills generates 3 to 10 skills to put in the list and then randomly generates the skills that it places in that list. But I don't want skills repeating,meaning if I have 8 skills going in a list I don't want to have 3 skill 7's...etc. Unfortunately Im stuck where to go from what I have here, currently I have a list of skills generating from 3 to 10 but I don't know not add duplicate numbers to the list if a generated skill is already in the list.
class skill
{
public:
skill(){}
skill(int i){x=i;}
~skill(){}
int getx(){return x;}
bool operator == (skill s){return (x==s.getx());}
void operator = (skill s){x=s.getx();}
void display(){cout<<"a"<<x<<" ";}
void generate1(list<skill>*S);
private:
int x;
};
void skill::generate1(list<skill>*Slist)
{
skill * s1;
srand (time (NULL));
int R,x;
R = 3+(rand()%7)+1;
for(int index=0; index<R; index++)
{
x =(rand()%10)+1;
s1 = new skill(index);
Slist->push_back(*s1);
}
}