Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

   

Engineering Projects
Projects for Engineering Students

For electronic engineers


Visit TDK's Application Guide
which shows our total solutions
for your application.

  

You are here Home  Computer Projects 

Employee Management System Using C++

Employee Management System Using


C++

 April 21, 2014  Engineeering Projects

Introduction to Employee
Management System Using C++
Employ management system using C++ is a menu-
driven program that allows us to add, update, delete
and search records of an employee working in an
organization. The program employee management
system stores employee ID, name, post, department,
and salary of the employee. Initially, it has no data.
Thus, we have to add employee records choosing
appropriate options in this program (i.e. selecting
option #1). Previously we had posted Employee
Management System Using C with the same features.

Employee Management system using C++ program


uses EmpID as a unique identiCer (i.e. primary key)
to recognize employee. So, we can’t add two
employees having the same ID. After successful entry
of records of some employees, we can search
records on the basis of ID or department. We can
search particular employees from ID choosing option
#2 and if we want to see all employees working in a
department, we have to choose another option (i.e.
option#3 in the menu). We can list all employee
records also using option #4 in the menu. Again, we
can update and delete existing records. Thus, this
project is useful to manage employee records in an
organization.

Before going to the software code part, let’s see the


output. The project Employee Management System
Using C++ is compiled using TurboC++

Figure 1: Main Menu of Employee Management


System Using C++

Figure 2: Adding New Employee Record

Figure 3: Searching Employee record using


Employee ID

Figure 4: Deleting Existing Employee Record

Check out other interesting C++ projects posted on


bestengineeringprojects.com

1. Telephone Diary using C++

2. 3D Ball, graphics-based project on C++

3. Base Conversion based on C++

4. Color the text [C++ Based]

Software Code for Employee Management System


Using C++:

C++
1 #include<iostream.h>
2 #include<conio.h>
3 #include<fstream.h>
4 #include<stdlib.h>
5 #include<iomanip.h>
6 #include<string.h>
7 #include<stdio.h>
8 const char
char** fileName
fileName=="Employee.txt"
"Employee.txt";;
9
10 class Employee
11 {
12 private
private: :
13 int EmpID
EmpID;;
14 char EmpName
EmpName[ [50
50]], Post
Post[ [50
50]], Department
Department[[10
10]];
15 float Salary
Salary; ;
16 public
public::
17 void ReadData
ReadData( () ;
18 int GetID
GetID(() ;
19 void DisplayRecord
DisplayRecord( () ;
20 char
char** GetDepartment
GetDepartment( () ;
21 };
22
23 void Employee
Employee:: ::ReadData
ReadData( ()
24 {
25 cout
cout<<
<<endl
endl<<<<"Employee
"Employee ID:"
ID:";;
26 cin
cin>>
>>EmpID
EmpID; ;
27 cout
cout<<
<<"Employee
"Employee Name:"Name:";
;
28 cin
cin>>
>>EmpName
EmpName; ;
29 cout
cout<<
<<"Employee's
"Employee's Post:"Post:";;
30 cin
cin>>
>>Post
Post;;
31 cout
cout<<
<<"Employee's
"Employee's Department:"
Department:";
;
32 cin
cin>>
>>Department
Department; ;
33 cout
cout<<
<<"Salary:"
"Salary:"; ;
34 cin
cin>>
>>Salary
Salary; ;
35 }
36
37 void Employee
Employee::
::DisplayRecord
DisplayRecord( ()
38 {
39 cout
cout<<
<<endl
endl<<
<<"_____________________________
"_____________________________
40 cout
cout<<
<<endl
endl<<
<<setw
setw((5 ) <<
<<EmpID
EmpID<<
<<setw
setw(
(15
15)
)<<
<<EmpN
EmpN
41 }
42
43 int Employee
Employee::
::GetID
GetID(()
44 {
45 return EmpID
EmpID;;
46 }
47
48 char
char** Employee
Employee::
::GetDepartment
GetDepartment(()
49 {
50 return Department
Department;;
51 }
52
53 void main
main( ()
54 {
55 Employee emp emp, ,e ;
56 char option
option, ,ch
ch, ,Dept
Dept[ [50
50]];
57 int IDID, ,isFound
isFound; ;
58 clrscr
clrscr( () ;
59 fstream file file; ;
60 file
file. .open
open( (fileName
fileName, ,ios
ios::
::ate
ate||ios
ios:: ::in
in||ios
ios::
::oo
61 do
62 {
63 cout
cout<<<<"*******Menu********"
"*******Menu********"; ;
64 cout
cout<<<<endl
endl<<<<"Enter
"Enter your option"option"; ;
65 cout
cout<<<<endl
endl<<<<"1"1 => Add a new record" record"; ;
66 cout
cout<<<<endl
endl<<<<"2"2 => Search record from emplo
67 cout
cout<<<<endl
endl<<<<"3"3 => List Employee of particu
68 cout
cout<<<<endl
endl<<<<"4"4 => Display all employee" employee"; ;
69 cout
cout<<<<endl
endl<<<<"5"5 => Update record of an empl
70 cout
cout<<<<endl
endl<<<<"6"6 => Delete record of particu
71 cout
cout<<<<endl
endl<<<<"7"7 => Exit from the program" program"<< <<
72 cout
cout<<<<"********************"
"********************"<< <<endl
endl; ;
73 cin
cin>>
>>option
option; ;
74 switch
switch( (option
option) )
75 {
76 case '1''1': :
77 emp
emp..ReadData
ReadData( () ;
78 file
file. .seekg
seekg( (0 , ios
ios::::beg
beg)
);
79 isFound
isFound= =0 ;
80 file
file. .read
read( (( char
char* *) &e
&e,,sizeof
sizeof( (e ) ) ;
81 while
while( (! file
file. .eof
eof( () )
82 {
83 if
if((e . GetID
GetID( () ==
==emp
emp. .GetID
GetID(() )
84 {
85 cout
cout<<<<"This
"This ID already exist...Try for ano
86 isFound
isFound= =1 ;
87 break
break; ;
88 }
89 file
file. .read
read( (( char
char* *) &e
&e,,sizeof
sizeof( (e ) ) ;
90 }
91 if
if((isFound
isFound== ==1 1)
92 break
break; ;
93 file
file. .clear
clear( () ;
94 file
file. .seekp
seekp( (0 , ios
ios::::end
end)
);
95 file
file. .write
write( (( char
char* *) &emp
&emp,, sizeof
sizeof( (emp
emp))) ;
96 cout
cout<<<<endl
endl<<<<"New
"New record has been added suc
97 break
break; ;
98
99 case '2' '2': :
100 isFound
isFound= =0 ;
101 cout
cout<< <<endl
endl<< <<"Enter
"Enter ID of an employee to be
102 cin
cin>>>>IDID;;
103 file
file. .seekg
seekg( (0 , ios
ios::
::beg
beg) );
104 file
file. .read
read( (( char
char* *) &e
&e,,sizeof
sizeof((e ) ) ;
105 while
while( (! file
file. .eof
eof(() )
106 {
107 if
if( (e . GetID
GetID( () ==
==ID
ID))
108 {
109 cout
cout<< <<endl
endl<< <<"The
"The record found...."
found...."<< <<endl
endl;;
110 cout
cout<< <<endl
endl<< <<setw
setw( (5 ) <<
<<"ID"
"ID"<<
<<setw
setw( (15
15))<<
<<"Name
"Name
111 e . DisplayRecord
DisplayRecord( () ;
112 isFound
isFound= =1 ;
113 break
break; ;
114 }
115 file
file. .read
read( (( char
char* *) &e
&e,,sizeof
sizeof((e ) ) ;
116 }
117 file
file. .clear
clear( () ;
118 if
if( (isFound
isFound== ==00)
119 cout
cout<< <<endl
endl<< <<"Data
"Data not found for employee I
120 break
break; ;
121 case '3' '3': :
122 isFound
isFound= =0 ;
123 cout
cout<< <<"Enter
"Enter department name to list emplo
124 cin
cin>>>>Dept
Dept; ;
125 file
file. .seekg
seekg( (0 , ios
ios::
::beg
beg) );
126 file
file. .read
read( (( char
char* *) &e
&e,,sizeof
sizeof((e ) ) ;
127 while
while( (! file
file. .eof
eof(() )
128 {
129 if
if( (strcmp
strcmp( (e . GetDepartment
GetDepartment( () , Dept
Dept) )==
==00)
130 {
131 cout
cout<< <<endl
endl<< <<"The
"The record found for this dep
132
133 cout
cout<<<<endl
endl<<<<setw
setw(
(5 ) <<
<<"ID"
"ID"<<
<<setw
setw( (15
15))<<
<<"Name
"Name
134 e . DisplayRecord
DisplayRecord( () ;
135 isFound
isFound= =1 ;
136 break
break; ;
137 }
138 file
file. .read
read( (( char
char**) &e
&e,,sizeof
sizeof((e ) ) ;
139 }
140 file
file. .clear
clear( () ;
141 if
if( (isFound
isFound== ==00)
142 cout
cout<<<<endl
endl<<<<"Data
"Data not found for department
143 break
break; ;
144
145 case '4'
'4'::
146 cout
cout<<<<endl
endl<<<<"Record
"Record for employee"
employee"; ;
147 file
file. .clear
clear( () ;
148 file
file. .seekg
seekg( (0 , ios
ios::
::beg
beg) );
149 int counter
counter= =0 ;
150 file
file. .read
read( (( char
char* *) &e
&e, ,sizeof
sizeof((e ) ) ;
151 while
while( (! file
file. .eof
eof(() )
152 {
153 counter
counter++ ++;;
154 if
if( (counter
counter== ==11)
155 {
156 cout
cout<<<<endl
endl<<<<setw
setw( (5 ) <<
<<"ID"
"ID"<<
<<setw
setw( (15
15))<<
<<"Name
"Name
157 }
158 e . DisplayRecord
DisplayRecord( () ;
159 file
file. .read
read( (( char
char* *) &e
&e, ,sizeof
sizeof((e ) ) ;
160 }
161 cout
cout<<<<endl
endl<<<<counter
counter<< <<"records
"records found......"
162 file
file. .clear
clear( () ;
163 break
break; ;
164
165 case '5' '5': :
166 int recordNo
recordNo= =0 ;
167 cout
cout<< <<endl
endl<<<<"File
"File is being modified...."
modified....";
;
168 cout
cout<< <<endl
endl<<<<"Enter
"Enter employee ID to be updat
169 cin
cin>>>>IDID;;
170 isFound
isFound= =0 ;
171 file
file. .seekg
seekg( (0 , ios
ios::
::beg
beg)
);
172 file
file. .read
read( (( char
char* *) &e
&e,,sizeof
sizeof((e ) ) ;
173 while
while( (! file
file. .eof
eof( () )
174 {
175 recordNo
recordNo++ ++;;
176 if
if( (e . GetID
GetID( () ==
==ID
ID))
177 {
178 cout
cout<< <<"The
"The old record of employee having I
179 e . DisplayRecord
DisplayRecord( () ;
180 isFound
isFound= =1 ;
181 break
break; ;
182 }
183 file
file. .read
read( (( char
char* *) &e
&e,,sizeof
sizeof((e ) ) ;
184 }
185
186 if
if( (isFound
isFound==
==00)
187 {
188 cout
cout<<<<endl
endl<<
<<"Data
"Data not found for employee I
189 break
break; ;
190 }
191 file
file. .clear
clear(() ;
192 int location
location= =( recordNo
recordNo- -1 ) * sizeof
sizeof( (e ) ;
193 file
file. .seekp
seekp((location
location, ,ios
ios::
::beg
beg));
194 cout
cout<<<<endl
endl<<
<<"Enter
"Enter new record for employee
195 e . ReadData
ReadData(() ;
196 file
file. .write
write((( char
char**) &e
&e,, sizeof
sizeof( (e ) ) ;
197 break
break; ;
198
199 case '6' '6': :
200 recordNo
recordNo= =0 ;
201 cout
cout<< <<endl
endl<<<<"Enter
"Enter employment ID to be del
202 cin
cin>>>>IDID;;
203 isFound
isFound= =0 ;
204 file
file. .seekg
seekg( (0 , ios
ios::::beg
beg));
205 file
file. .read
read( (( char
char* *) &e
&e,
,sizeof
sizeof((e ) ) ;
206 while
while( (! file
file. .eof
eof( () )
207 {
208 recordNo
recordNo++ ++;;
209 if
if( (e . GetID
GetID( () ==
==ID
ID) )
210 {
211 cout
cout<< <<" " The old record of employee having
212 e . DisplayRecord
DisplayRecord( () ;
213 isFound
isFound= =1 ;
214 break
break; ;
215 }
216 file
file. .read
read( (( char
char* *) &e
&e,
,sizeof
sizeof((e ) ) ;
217 }
218 char tempFile
tempFile[ [] = "temp.txt"
"temp.txt"; ;
219 fstream temp temp( (tempFile
tempFile, ,ios
ios::
::out
out| |ios
ios::
::binary
binary
220 if
if( (isFound
isFound== ==00)
221 {
222 cout
cout<< <<endl
endl<<<<"Data
"Data not found for employee I
223 break
break; ;
224 }
225 else
226 {
227 file
file. .clear
clear( () ;
228 file
file. .seekg
seekg( (0 , ios
ios::::beg
beg));
229 file
file. .read
read( (( char
char* *) &e
&e,
,sizeof
sizeof((e ) ) ;
230 while
while( (! file
file. .eof
eof( () )
231 {
232 if
if( (e . GetID
GetID( () !=
!=ID
ID) )
233 temp
temp. .write
write( (( char
char* *) &e
&e,,sizeof
sizeof( (e ) ) ;
234 file
file. .read
read( (( char
char* *) &e
&e,
,sizeof
sizeof((e ) ) ;
235 }
236 file
file. .close
close( () ;
237 temp
temp. .close
close( () ;
238 temp
temp. .open
open( (tempFile
tempFile, ,ios
ios::
::in
in||ios
ios::::binary
binary));
239 file
file. .open
open( (fileName
fileName, ,ios
ios::
::out
out| |ios
ios:: ::binary
binary));
240 temp
temp. .read
read( (( char
char* *) &e
&e,
,sizeof
sizeof((e ) ) ;
241 while
while( (! temp
temp. .eof
eof( () )
242 {
243 file
file. .write
write( (( char
char* *) &e
&e,,sizeof
sizeof( (e ) ) ;
244 temp
temp. .read
read( (( char
char* *) &e
&e,
,sizeof
sizeof((e ) ) ;
245 }
246 }
247 temp
temp. .close
close( () ;
248 file
file. .close
close( () ;
249 remove
remove( (tempFile
tempFile) );
250 file
file. .open
open( (fileName
fileName, ,ios
ios::
::ate
ate| |ios
ios:: ::in
in|
|ios
ios::
::oo
251 break
break; ;
252
253 case '7'
'7': :
254 exit
exit((0 ) ;
255 break
break;;
256
257 default
default: :
258 cout
cout<<
<<"Invalid
"Invalid Options"
Options";
;
259 }
260 cout
cout<<
<<"\nDo
"\nDo you want to continue.....?y/n"
261 cin
cin>>
>>ch
ch;;
262 } while
while((ch
ch!=
!='n'
'n'));
263 }

Share this:

  1 

Improve customer retention


Ad parcelLab GmbH

India's Finest Hand


Carving
Ad Pratistha Marble Moorti

IQ test - What is
your IQ?
Ad test-iq.org

Who Were You In


Past Life ?
Ad AstroMary

C++ Based Projects Computer Projects

 Wind Sound Generator Telephone Diary using


Using IC 741 C++ 

5 THOUGHTS TO “EMPLOYEE MANAGEMENT

SYSTEM USING C++”

max
 November 12, 2014 at 10:27 am
The above given source code is
only working in turbo c++ why not working in
Dev-c.

Reply

Engineeering Projects
 December 25, 2015 at 4:18
am
Here are few parameter and keyword
which is not supported by DEV-C++

Reply

Aminu Bello
 December 24, 2015 at 8:21 pm
Websites like this are really good,
because they help other people who need help
or are weak in programming . Keep up the
good work. God bless

Reply

sonali
 May 4, 2016 at 11:59 am
how to run the program

Reply

Bilal
 May 26, 2016 at 2:28 am
sir please tell me how i can run this
program in dev C++.
please answer my question urgently.

Reply

LEAVE A COMMENT

Comment

Name

Email

Website URL

Notify me of follow-up comments by email.

Notify me of new posts by email.

ADD COMMENT

Categories

555 Timer Projects (67)

8051 Projects (12)

AC Voltage Stabilizer (6)

alarm / sound generator (33)

AmpliCer Circuit (26)

Antenna Fundamental (11)

Arduino Projects (83)

ATmega Projects (11)

Automobile Engineering (8)

Automotive Circuit (7)

AVR Projects (8)

Basic Electronic Projects (48)

Battery Charger Circuit (14)

Bearing Capacity Theories (17)

C Based Project (18)

C++ Based Projects (5)

Civil Projects (121)

Coierdams (3)

Computer Projects (24)

Conductor and Connection (1)

Digital Electronics Projects (25)

Diode (6)

Earth Pressure and Retaining Wall (19)

Easy Electronics Projects (22)

Electrical Projects (9)

Electrical Symbols (3)

Electronic Game and Fun Projects (12)

Electronic Measurement and Tester Circuit (32)

Electronic Timer Circuit (10)

Electronic Tutorial (97)

Electronics and Communication Projects (21)

Electronics Design (57)

Electronics Projects (424)

Electronics Troubleshooting (16)

Field Eiect Transistors (3)

Geotechnical Process (7)

IC 741 Based Projects (35)

IOT Projects (7)

Led Projects (8)

Machine Foundation (11)

Mat Foundation (5)

Microcontroller Projects (28)

Microprocessor Program (2)

Microwaves (22)

Motor Driver Circuit (11)

Nonsinusoidal Generator (5)

Numerical method Lab Manual (1)

Op amp Tutorials (10)

Oscillators and Signal Generators (2)

PIC Projects (4)

Piers and Caissons (7)

Piled Foundation (15)

power supply (46)

Python (1)

RFID Projects (3)

Robotics (5)

Sheet Pile Wall (6)

Site Investigation (20)

Spread Foundation (9)

Switching and Controlling (41)

Tech (11)

Top 10 Electronics Projects (2)

Transistor AmpliCers (22)

VeriCed PreampliCer Circuit (16)

Top Posts & Pages

50+ Top 555 Timer IC Projects

Component Parts of a Well Foundation

Analysis of Common Emitter AmpliCer


using h-parameters

Employee Management System Using


C++

What are the Applications of


microwaves

Measuring Temperature using PT100


and Arduino

Operation AmpliCer 741 Based


Projects

Plate Load Test | Plate Load Test


Procedure and Limitation

Mini Projects using IC 741

Op-amp | Block Diagram |


Characteristics of Ideal and Practical
Op-amp

Recent Posts

Automatic Solder Smoke Extractor


The Importance of Maintaining Elevators in
Residential Units
Arduino Countdown Timer using P10 Display
Pulse Amplitude Modulation
Diierent Ways Of Joining Metals Without
Welding

Copyright © All rights reserved

You might also like