i have 10 object (a[10]) that they have int x and int y in their class.
now i want get number for x and y with rand()(min=1 and max=15)
and now each object have a position like (3,7)
i need a function (or two) that find same position and if finded give new position and then check for same position again
Code:#include <iostream.h> #include <stdlib.h> class chess{ public : chess(); //constructor private: int x; int y; }; main() { chess a[10]; } chess::chess() //get position { x=rand()%15+1; //rand()%max+min will give values from min to min+max-1 y=rand()%15+1; }