hey guys am trying to arrange my values from smallest to biggest using vector....if the value in position 0 is greater than the value at position one than swap the two than reapeats for value at position 1 and that at position 2.so on and so on..the algorithm goes on until all values in the vector have been compared...bt my problem is that code crushes...sayin out of range. please help..plus am i using pointers in a vector the right way?.....thanx in advance
> than reapeats for value at position 1 and that at position 2.so on and so on
¿so on how?
> swap the two num->at(i)=num->at(i+1); is not swapping, just assignment.
> am i using pointers in a vector the right way?
no.
I want to understand your thought process int x=0; there you declared an integer variable and initialize it.
But for some reason that was too complicated for a vector, so you come up with vector<int>* num = new vector<int>(); http://www.cplusplus.com/forum/general/138037/