void genRandPointVariety( g:: Point points[ ] , int amount) {
std:: vector < g:: Point > v;
g:: Point * p = NULL ;
//Генерируем множество произвольных точек в количестве amount
srand ( time ( NULL ) ) ;
for ( int i = 0 ; i < amount; i++ ) {
int x = std:: rand ( ) % 1024 ;
int y = std:: rand ( ) % 1024 ;
p = new g:: Point ( ) ;
p- > x = x;
p- > y = y;
v.push_back ( * p) ;
delete p;
}
//Удаляем повторяющиеся точки, если такие есть
std:: vector < g:: Point > :: iterator it;
it = std:: unique ( v.begin ( ) , v.end ( ) , pt_cmp) ;
v.erase ( it, v.end ( ) ) ;
//Если после удаления точек в векторе меньше, чем нужно,
//Добавляем по одной, проверяя уникальность
while ( v.size ( ) < amount) {
int x = std:: rand ( ) % 1024 ;
int y = std:: rand ( ) % 1024 ;
p = new g:: Point ( ) ;
p- > x = x;
p- > y = y;
v.push_back ( * p) ;
it = std:: unique ( v.begin ( ) , v.end ( ) , pt_cmp) ;
v.erase ( it, v.end ( ) ) ;
delete p;
}
}
dm9pZCBnZW5SYW5kUG9pbnRWYXJpZXR5KGc6OlBvaW50IHBvaW50c1tdLCBpbnQgYW1vdW50KXsKCXN0ZDo6dmVjdG9yPGc6OlBvaW50PiB2OwoJZzo6UG9pbnQgKnAgPSBOVUxMOwoJCgkvL9CT0LXQvdC10YDQuNGA0YPQtdC8INC80L3QvtC20LXRgdGC0LLQviDQv9GA0L7QuNC30LLQvtC70YzQvdGL0YUg0YLQvtGH0LXQuiDQsiDQutC+0LvQuNGH0LXRgdGC0LLQtSBhbW91bnQKCXNyYW5kKHRpbWUoTlVMTCkpOwoJZm9yKGludCBpID0gMDsgaSA8IGFtb3VudDsgaSsrKXsKCQlpbnQgeCA9IHN0ZDo6cmFuZCgpICUgMTAyNDsKCQlpbnQgeSA9IHN0ZDo6cmFuZCgpICUgMTAyNDsKCQlwID0gbmV3IGc6OlBvaW50KCk7CgkJcC0+eCA9IHg7CgkJcC0+eSA9IHk7CgkJdi5wdXNoX2JhY2soKnApOwoJCWRlbGV0ZSBwOwoJfQoKCS8v0KPQtNCw0LvRj9C10Lwg0L/QvtCy0YLQvtGA0Y/RjtGJ0LjQtdGB0Y8g0YLQvtGH0LrQuCwg0LXRgdC70Lgg0YLQsNC60LjQtSDQtdGB0YLRjAoJc3RkOjp2ZWN0b3I8Zzo6UG9pbnQ+OjppdGVyYXRvciBpdDsKCWl0ID0gc3RkOjp1bmlxdWUodi5iZWdpbigpLCB2LmVuZCgpLCBwdF9jbXApOwoJdi5lcmFzZShpdCwgdi5lbmQoKSk7CgoJLy/QldGB0LvQuCDQv9C+0YHQu9C1INGD0LTQsNC70LXQvdC40Y8g0YLQvtGH0LXQuiDQsiDQstC10LrRgtC+0YDQtSDQvNC10L3RjNGI0LUsINGH0LXQvCDQvdGD0LbQvdC+LAoJLy/QlNC+0LHQsNCy0LvRj9C10Lwg0L/QviDQvtC00L3QvtC5LCDQv9GA0L7QstC10YDRj9GPINGD0L3QuNC60LDQu9GM0L3QvtGB0YLRjAoJd2hpbGUodi5zaXplKCkgPCBhbW91bnQpewoJCWludCB4ID0gc3RkOjpyYW5kKCkgJSAxMDI0OwoJCWludCB5ID0gc3RkOjpyYW5kKCkgJSAxMDI0OwoJCXAgPSBuZXcgZzo6UG9pbnQoKTsKCQlwLT54ID0geDsKCQlwLT55ID0geTsKCQl2LnB1c2hfYmFjaygqcCk7CgkJaXQgPSBzdGQ6OnVuaXF1ZSh2LmJlZ2luKCksIHYuZW5kKCksIHB0X2NtcCk7CgkJdi5lcmFzZShpdCwgdi5lbmQoKSk7CgkJZGVsZXRlIHA7Cgl9Cn0=
compilation info
prog.cpp:1:26: error: variable or field 'genRandPointVariety' declared void
void genRandPointVariety(g::Point points[], int amount){
^
prog.cpp:1:26: error: 'g' has not been declared
prog.cpp:1:45: error: expected primary-expression before 'int'
void genRandPointVariety(g::Point points[], int amount){
^
stdout