can someone PLEASE KINDLY help me on how to add new records to input fie( in this case its "datafile.dat"). i want to add new employee records to my "datafile.dat"
Also, How can i delete an employee record from the datafile? i understand that it needs a matching name for delete purpose, but HOW do i insert that match funtion into my program?
PLEASE CHECK IF I HAVE ANY OTHER MISTAKES IN MY CODE. I WUD B XTREMELY GRATEFUL
THANX A LOT!!!!!!!!!
#include < iostream.h>
#include < iomanip.h>
#include < fstream.h>
#include < string.h>
EmployeeList *List = new EmployeeList;
// Open the data file for reading
//Get the first line to check if it is 'done'
In >> NewName;
// Add employees to the list until they enter 'done'
while(strcmp(NewName, "done") != 0)
cout <<"Please choose one of the following menu selections:\n";
cout <<"A. Add a record \n";
cout <<"B. Delete a record \n";
cout <<"C. Display all records \n";
cout <<"D. Exit \n";
case 'A' : result.AddEmployee(); break;
case 'B' : result.DeleteEmployee(); break;
case 'C' :result.DisplayEmployee;
case 'D' : NewName == "done" ; break;
// Get the remaining data for the employee
In >> NewDepartment >> NewSalary;
// Create the employee and assign the values
Employee *NewEmployee = new Employee(NewName, NewDepartment, NewSalary);
// Get the next name or 'done'
In >> NewName;
Raj Computer 90000
Ayesha Accounting 95000
Jr.Raj Operational 140000
Ali Business 50000
Zainab Accountin 45000
done x 0