Introduction to OOP | Chapter 21: Software Frameworks : | next | previous | audio | real | text |
class Employee { public: string name; int salary; int startingYear; } | void sort (Employee * data[ ], int n) { for (int i = 1; i < n; i++) { int j = i-1; while (j >= 0 && v[j+1]->startingYear < v[j]->startingYear) { // swap elements Employee * temp = v[j]; v[j] = v[j+1]; v[j+1] = temp; j = j - 1; } } } |