ASDV-Cpp/Assignments/lab4-Structures_CalebFontenot/structures.h

63 lines
1.4 KiB
C

2024-03-25 20:54:15 +07:00
//
// Created by caleb on 3/25/24.
//
#ifndef STRUCTURES_H
#define STRUCTURES_H
#include <string>
struct Employee
{
Employee( char * pName, double salary);
Employee( char * pName, char * pAddress, char nameOfSpouse[50], double salary);
~Employee();
2024-04-01 10:35:00 +07:00
Employee &operator=(const Employee &rhs);
Employee(const Employee &rhs);
Employee &operator=(Employee &&rhs);
Employee(Employee &&rhs);
2024-03-25 20:54:15 +07:00
char * pName;
char * pAddress;
char nameOfSpouse[50];
double salary;
std::string toString();
};
/** Populates a dynamic 2D array of employees by reading the data from the console.
*
* @param pp existing 2D array to be populated.
* @param rows number of rows
* @param col number of columns
*/
void populate(Employee **pp, int rows, int col );
/** Prints the 2D dynamic array.
*
* @param pp the dynamic array
* @param rows number of rows
* @param col number of columns
*/
void print(Employee **pp, int rows, int col );
/** Frees all memory occupied by the array.
*
* @param pp the dynamic array
* @param rows number of rows
* @param col number of columns
*/
2024-04-01 10:35:00 +07:00
void free(Employee **pp, int rows, int col);
2024-03-25 20:54:15 +07:00
/**Sorts the dynamic array in ascending order by name.
*
* @param pp the dynamic array
* @param rows number of rows
* @param col number of columns
*/
void sort(Employee **pp, int rows, int col );
#endif /* STRUCTURES_H */