c++ - Cout Vector in Random Coordinates n times -


i trying cout vector 12 times in loop @ random coordinates. have created vector here:

vector<item> sv(maxpills, pill); 

currently prints 1 of vector out. code random coordinates of vector , attempt @ printing 12 of them out. i'd appreaciate if help!

    void generatepowerpills(char gr[][sizex], item pill){     (int = 0; < 12; i++)     {         gr[pill.y][pill.x] = pill.symbol;     } } void initialiserandompillscoordinates(vector<item>& sv) {     //pass vector function give each pill random coordinates     seed();     (size_t i(0); < sv.size(); ++i)     {         sv.at(i).y = random(sizey - 2);    //vertical coordinate in range [1..(sizey - 2)]         sv.at(i).x = random(sizex - 2);    //horizontal coordinate in range [1..(sizex - 2)]     } } 

i'd comment sadly can answer. anyway, you're iterating here:

 (int = 0; < 12; i++) {     gr[pill.y][pill.x] = pill.symbol; } 

but using "i" inside loop? seems same, 12 times. unless there's hidden functionality somewhere inside, if so, shame on me.


Comments

Popular posts from this blog

SQL php on different pages to Insert (mysqli) -

php - How can an email be returned from Stripe Checkout? -

sql - Partition elimination in Greenplum -