/********************************************************************* C201 Computer Programming II Fall 2006 Dana Vrajitoru & Definition of the structure Employee and functions to manipulate it. **********************************************************************/ #ifndef EMPLOYEE_H #define EMPLOYEE_H enum Flags { hourly_flag = 3, gender_flag = 4 }; enum Gender { male, female }; struct Employee_rec { char name[20]; int id; float salary; }; // Outputs the values in an employee record. void Output_rec(Employee_rec person); // Outputs all the records in an array. void Output_all(Employee_rec staff[], int size); // Inputs the values in an employee record. void Input_rec(Employee_rec &person); // Inputs all the records in an array. This supposes that the size is // known and the array has been allocated before. void Input_all(Employee_rec staff[], int size); // Sorts all the records in an array by the name. void Sort_by_name(Employee_rec staff[], int size); // Sorts all the records in an array by the id. void Sort_by_id(Employee_rec staff[], int size); // Sorts all the records in an array by the salary. void Sort_by_salary(Employee_rec staff[], int size); // Checks if the person is an hourly employee. bool Is_hourly(Employee_rec person); // Checks if the person is male. bool Is_male(Employee_rec person); // Checks if the person is female. bool Is_female(Employee_rec person); // Sets the hourly flag of the person's id to true. void Set_hourly(Employee_rec &person); // Sets the gender of the employee as male or female. void Set_gender(Employee_rec &person, Gender mf); // Outputs all of the hourly employees in the staff. void Output_all_hourly(Employee_rec staff[], int size); // Outputs all the employees with gender information. void Output_all_gender(Employee_rec staff[], int size); // Bitwise operations // Extracts the value of a bit in the binary representation of a // number. int Bit_extract(int n, int i); // Sets the bit at position i to the 0. void Set_zero_bit(int &n, int i); // Sets the bit at position i to 1. void Set_one_bit(int &n, int i); // Negates all the bits in the number n except for the sign bit. void Negate_bits(int &n); #endif