/********************************************************************************** * Course Number : CIS-112 * * Assignment : Project # 4 * * Due Date : May 8/9, 2002 * * Author : Jim Chaires * * Instructor : Jim Chaires * * Input : Disk File - "personel.bin" * * Output : Screen/Printer * * Program Objective: Program # 4 takes program # 3 and uses objects and * * classes instead of structures. As in program #3, an array * * is built, the array is sorted on name and employees who * * make more than $41,000 are printed. * **********************************************************************************/ #include // PREPROCESSOR DIRECTIVES #include #include #include #include #include ifstream employee_file ("d:personel.bin", ios::in|ios::binary); class employee { private: char last_name [13]; long int ssn; double salary; int years; int dept; public: void open_input_file_fcn (); void print_headers_fcn (); int build_print_array_fcn(employee employee_rec[]) ; void sort_print_array_fcn (employee employee_rec[], int) ; }; // must have both type and identifier name //****************************************************************************** void employee::open_input_file_fcn () { if (employee_file.fail ()) { clrscr(); cout << ("There is a problem locating the input file\n"); exit(1); } cout << endl << "Hello:" << endl ; // take this out. } // end fcn //****************************************************************************** void main() { cout << setprecision (2) << setiosflags(ios::fixed) << setiosflags(ios::showpoint); int numitems = 0; clrscr(); class employee employee_rec[50]; // creates an array of 50 employee objects employee_rec[0].open_input_file_fcn() ; // employee_rec[0].print_headers_fcn () ; // numitems = employee_rec[0].build_print_array_fcn (employee_rec) ; // employee_rec[0].sort_print_array_fcn (employee_rec, numitems) ; // cout << "\n\n"; system ("PAUSE"); // Used with version 5.00/5.02 } // end of main ( )