#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Cords
{
public:
int x,y,z;
};
class Object:public Cords
{
int a,b,c;
public:
vector<Cords> vCords;
void insertCords();
void getCords();
};
void Object::insertCords()
{
Cords theCords;
int x=1;
do
{
cout<<"Enter X:"<<endl;
cin>>x;
cout<<"Enter a b c:"<<endl;
cin>>a>>b>>c;
theCords.x=a;
theCords.y=b;
theCords.z=c;
vCords.push_back(theCords);
}while(x!=0);
}
void Object::getCords()
{
cout<<"ORIGINAL VALUES BEFORE SORTING:"<<endl;
for(int i=0;i<vCords.size();i++)
cout<<vCords[i].x<<" "<<vCords[i].y<<" "<<vCords[i].z<<endl;
**sort(vCords.begin(),vCords.end());**
}
int main()
{
Object obj;
obj.insertCords();
obj.getCords();
return 0;
}
HOw to use sort function for vector vCords. It din't work with algorithm sort(). Is there other possibility of sorting these types of vectors