ABC Company deals with import and export textiles. The company has few department and about 50 employees. The company has requested you to write a C++ program for file based database for employee in code blocks.
The system must also be able to add employee when new employee joined the company. The system must also be able to edit the record search for employee record. When Employee leaves the company it must allow them
to delete the record.
You must use C++ program to create file based system to add view search edit delete the records and we should be able to exit the program
Your program must include necessary validation to accept the correct input for adding and editing record.
Sample screen design of each function is shown below:
You will need to create functions for each of the 5 menu options. Entering the number will call the correct function.
I have done the add view delete and exit the program. I just need program for search and edit and validation of the full program.
My program:
#include
#include
#include
#include
#include
#include
using namespace std;
void add_rec();//function declaration
void view_rec();
void edit_rec();
void search_rec();
void delete_rec();
void quit();
struct info
{
char ID[4];
char name[21];
char address[36];
int age;
double salary;
};
void add_rec()
{
system(CLS);
cout<
cout<
cin.ignore();//skip over the remaining newline.
//write the content of the info structure to the file.
info.write(reinterpret_cast
//determine whether the user wants to write another record.
cout<
cin.ignore();//skip over the remaining newline.
}while (answer == ‘Y’ || answer == ‘y’);
}
int main()
{
int choice;
cout<
while(choice != 6)
{
switch(choice)
{
case 1:
add_rec();
break;
case 2:
view_rec();
break;
case 3:
search_rec();
break;
case 4:
edit_rec();
break;
case 5:
delete_rec();
break;
default:
cout<
}
quit();
return 0;
}
void quit()
{
cout<<--------------------------------------<
//while not at the end of the file display the record.
while(!info.eof())
{
//display
cout<< ID: ;
cout<
}
}
void search_rec()
{
cout<< search function under construction.<
{
if(strcmp(emp.IDID)!=0)
{
outfile.write(reinterpret_cast
}
}
outfile.close();
info.close();
remove(employee.dat);
rename(temp.datemployee.dat);
cout<