i have a class with 10 object and each object have a random position like (x,y)
now i wand a code that do not put object in same position
please complete my code
#include <iostream.h>
#include <time.h>
#include <stdlib.h>
class chess{
public :
chess();
private :
int x;
int y;
};
chess::chess()
{
x=rand()%15+1; //rand()%max+min will give values from min to min+max-1
y=rand()%15+1;
}
main()
{
chess a[10];
}