2024-03-25 20:54:15 -05:00
|
|
|
#include <iostream>
|
2024-04-01 10:35:00 -05:00
|
|
|
#include <memory>
|
2024-03-25 20:54:15 -05:00
|
|
|
#import "structures.h"
|
|
|
|
int main() {
|
|
|
|
Employee *emp1 = new Employee("Jeff Bezos", 1);
|
|
|
|
std::cout << emp1->toString();
|
2024-04-01 10:35:00 -05:00
|
|
|
delete emp1;
|
|
|
|
int rows = 2;
|
|
|
|
int col = 2;
|
|
|
|
Employee **employeeArray = (Employee**) std::calloc(col, sizeof(Employee*)); // Allocate memory for the Employee structs
|
|
|
|
for (int i = 0; i < col; ++i) {
|
|
|
|
employeeArray[i] = (Employee*) std::calloc(rows, sizeof(Employee));
|
|
|
|
}
|
|
|
|
populate(employeeArray, rows, col);
|
|
|
|
print(employeeArray, rows, col);
|
|
|
|
sort(employeeArray, rows, col);
|
|
|
|
std::printf("After sort:\n");
|
|
|
|
print(employeeArray, rows, col);
|
|
|
|
for (int i = 0; i < col; ++i) {
|
|
|
|
free(employeeArray[i]);
|
|
|
|
}
|
|
|
|
free(employeeArray);
|
2024-03-25 20:54:15 -05:00
|
|
|
return 0;
|
|
|
|
}
|