#include #include #include using namespace std; class Subscriber{ public: string name, address, phone; double invoice; void print(){ cout<<"- Name: "<* v, int low, int high){ int pivot = v->at(high).invoice; int i = low - 1; for(int j = low; j <= high - 1; j++){ if(v->at(j).invoice > pivot){ i++; swap(v->at(i), v->at(j)); } } swap(v->at(i+1), v->at(high)); return i + 1; } void sort_quick(vector* v, int low, int high){ if(low < high){ int parti = sort_quick_partition(v, low, high); sort_quick(v, low, parti - 1); sort_quick(v, parti + 1, high); } } void sort_quick_driver(vector* v){ sort_quick(v, 0, v->size() - 1); } int main(){ ios::sync_with_stdio(false); cout<<"Number of subscribers: "; int n; cin>>n; vector v; for(int i=0; i>s.invoice; v.push_back(s); } sort_quick_driver(&v); cout<<"\n\n\nTop 3 invoice values:\n"; for(int i=0; i<3; i++){ v[i].print(); } cout.flush(); return 0; }