Human Resource Management Program , Add new employee , Delete employee information ,

mini-Project: Human Resource Management Program
इस प्रोजेक्ट मे एक कंपनी named ABC है और इस कंपनी मे दो डिपार्टमेंट है (1) : operation (2) : human resource department | इस प्रोजेक्ट मे HRD मे 100 employee के data को hold किया जाता है और इसे manage भी किया जाता है |
कंपनी ABC के HRD सॉफ्टवेर को बने गया है इसके निन्म operation को perform किया जाता है
1. Add new employee
2. Delete employee information
3. Update employee information
4. Make reports based on specific field
5. Search employee
6. Quit
इसमें class employeeको define किया जाता है | और इसके अलावा class HRD को भी define किया है | class employeeमे सभी वरिअब्क्ले को define किया जाता है और इसके  अलावा salaryary को calculate करते है | salaryary = “WorkingHours” * “CostPerHour” को calculate करते है |इसके अलावा इसमें निन्म function है :-Class employeeshould include following private fields:
1.input_firstname (String) : ये employee के first name को hold करता है |
2.LastName (String) : ये employee के last name को hold करता  है |
3.PersonalID (Integer) : ये employee id को hold करता है |
4.salaryary (Double) : ये employee का सलरी है |
5.WorkingHours (Double) : ये working hour होता है |
6.CostPerHour (Double) : ये cost per hour की value को hold करता है |
class employeeमे public function होनी चाहिए जो की private variable को set और get करने के लिए किया जाता है |
1.set_FieldName()
2.get_FieldName()

“PersonalID” हमेशा unique और auto increament होता है | इसलिए PersonalID की value को कभी भी input नहीं करता है |
class HRM मे निन्म private variable होता है |
1. Array of employees with the type employee(Private)
class HRM मे निन्म public function होता है |
1. AddPerson()
2. DeletePerson(…)
3. UpdatePerson(…)
4. ReportList(…)
5. SearchPerson(…)

1. AddPerson()
इस function मे , employee की information को इनोपुत करा लेते है |
इसके लिए working per hour और payment per hour को input करा लेते है |
और इसके लिए salaryary को calculate करते है |
2. DeletePerson(…)
इस function मे , यूजर की information को डिलीट किया जाता है |
3. UpdatePerson(…)
इस function से employeeकी data को update किया जाता है |
4. ReportList(…)
इस function मे , employee के data को show किया जाता है |
5. SearchPerson(…)
इस function मे employee को data को search किया जाता है |
Solution-
#include<iostream>
#include<math.h>
#include<cstdlib>
#include<string>
using namespace std;
class Person
{
private :
string first ;     // student name, max 49 characters
string Last;      // student family name
int ID ;
double salaryary ;
double WH ;
double CPM ;
public :
void set_FieldName();
void get_FieldName();
void gett_FieldName();
void set_PersonalID();
void set_Name();
void LastNamesortList();
void input_firstname();
void in_lastName();
void in_wp();
void in_CPM();
};
class HRM
{
private :
employeee[100] ;
employeetemp[100];
public :
void Add_Person();
void Delete_Person();
void Search_Person();
void Update_Person();
void Report_List();
};
int n=0,i=0,x=8248001,y[100];
bool flag=0;
int  z[100];
string h[100];
double salary[100];
int check=0;
void ::HRM::AddPerson() {
int x;
char redomm;
do
{
n++;
e[i].set_FieldName();
i++;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<n; i++){
e[i].get_FieldName();
}
cout<<“do u wont to add another employee”<<endl;
cin>>redomm;
}
while((redomm==’y’||redomm==’Y’));
}
void HRM::DeletePerson() {
int Id;
bool lol;
char redomm1,redomm2;
lol =false;
lebel:
cout << “ID of employee to remove: “;
while(!(cin>>Id))
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
for ( i = 0; i < n; ++i) {
if (y[i]==Id) {
e[i]=e[i+1];
lol=true;
e[i].set_Name();
cin>>redomm2;
if(redomm2==’Y’||redomm2==’y’){
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<a; i++){
e[i].get_FieldName();
cout<<“hahahahah=”<<n<<endl;
a–;
n=a;
n++;
}
///      goto lebel1;
}
cout <<endl;
//Delete function
}
}
if (lol==false) {
cout<<“Sorry, there is not any employee with requested personal number.”
<<” Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
cout<<endl<<endl;
}
}
}
void HRM::UpdatePerson(){
int Id;
char redomm1,redomm2;
lebel:
cout << “ID of employee to modify data: “;
while(!(cin>>Id))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
int flag1=0;
for (int i = 0; i < n; ++i) {
if (y[i]!=Id) {
flag1++;
}
}
/*  if (flag1==n){
// cout<<” not     matching=”<< y[i];
cout<<“Sorry, there is not any employee with requested personal number. Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
}
} */
cout <<endl;
lebel1:
for (int i = 0; i < n; ++i) {
if (y[i]==Id) {
cout<<“matching=”<< y[i];
flag=true;
int choice = 0;
char redom;
do {
cout << endl << endl;
cout << “Please enter the related number of field which you would like to update” << endl;
cout <<“1. First name” << endl;
cout << “2. Family name” << endl;
cout << “3. Working hours per week” << endl;
cout << “4. Payment for one hour” << endl;
cout << std::endl;
cin >> choice;
if (choice == 1) {
cout << ” First name: “;
e[i].input_firstname();
}
else if (choice == 2) {
cout << ” Family name: “;
e[i].input_family_name();
}
else if (choice == 3) {
cout << ” Working hours per week: “;
e[i].input_Workinghour();
}
else if (choice == 4) {
cout << ” Payment for one hour: “;
e[i].input_Costperhour();
}
cout<<“Do you want to update another field (Y/N)=”;
cin>>redom;
} while (redom==’y’||redom==’Y’);
}
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<a; i++){
e[i].get_FieldName();
cout<<“hahahahah=”<<n<<endl;
}
}
void ::Person::input_firstname()
{
cin>>input_firstname ;
}
void::Person::in_family_name()
{
cin>>LastName;
}
void::Person::in_Workinghour()
{
cin>>WorkingHours;
salaryary=WorkingHours*CostPerHour*52;
}
void::Person::in_Costperhour()
{
cin>>CostPerHour;
salaryary=WorkingHours*CostPerHour*52;
}
void HRM::ReportList() {
char op;
bool doMore;
cout<<“\nPlease enter the related number of the field which you would like to sort the list based on it.\n(1. Family name, 2.salaryary)?\n”<<endl;
//cin>>op;
while(!(cin>>op))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
switch(op)
{
case ‘1’:
cout<<“\nSorting based on Family Name\n”<<endl;
for(int i=0;i<=n;i++)
{
for(int j=i+1;j<=n-1;j++)
{
if(h[i]>h[i+1])
{
temp[i]=e[i];
e[i]=e[j];
e[j]=temp[i];
}
}
}
for(int i=0;i<n;i++)
{
e[i].get_FieldName();
}
cout<<“\nsorted\n”;
break;
case’2′:
cout<<“\nSorting based on salaryary\n”<<endl;
for(int h=0;h<n;h++)
{
for(int q=h+1;q<n;q++)
{
if(salary[h]>salary[h+1]);
{
temp[h]=e[h];
e[h]=e[q];
e[q]=temp[h];
}
}
}
for(int j=0;j<n;j++)
{
e[j].get_FieldName();
}
cout<<“\nsortedlist is printed above\n”;
break;
}
}
void HRM::SearchPerson(){
int c;
char redomm1;
string family_name;
double min,max;
do{
cout<<“Search is based on two different fields (1.family name, 2.salaryary), please enter your choice?=”<<endl;
//cin>>c;
while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
if(c==2)
{
cout<<“Please define your search range for salaryary of employees .”<<endl;
cout<<“What is minimum salaryary for search (S_min)?=”<<endl;
//cin>>min;
while(!(cin>>min))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“What is maximum salaryary for search (S_max)?=”<<endl;
//cin>>max;
while(!(cin>>max))
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);
// whichever comes first.
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;

for(int i=0; i<n; i++) {
if (z[i]>min && z[i]<max) {
cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].gett_FieldName();
cout<<“matching=”<< z[i];
}
}
}
else if(c==1)
{
cout<<“Please enter the family name of employee?”<<endl;
cin>>family_name;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<n; i++) {
if (h[i]==family_name) {
cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].get_FieldName();
cout<<“matching=”<< z[i];
}
}
}
cout<<“\nDo you want to Search any other field (y/n)?\n”<<endl;
cin>>redomm1;
}while(redomm1==’y’||redomm1==’Y’);
}
void ::Person::LastNamesortList() {
int temp2;
char temp,temp1;
}
void::employee::set_Name(){
cout<<“Do you really want to delete employee”<<FirstName<<“\t”<< LastName<< “(y/n)?:”;   //PersonalID=y[i];
}
int k=0;
void::employee::set_FieldName(){
PersonalID=x;
x++;
cout<<n;
cout<<“First Name=”;
while(!(cin>>FirstName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“Last Name=”;
while(!(cin>>LastName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“How many hours a week is his/her work? =”;
;
while(!(cin>>WorkingHours))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“How much per hour is his/her salaryary? =”;
while(!(cin>>CostPerHour))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
salaryary=WorkingHours*CostPerHour*52;
z[i]= salaryary;
salary[i]=salaryary;
h[i]=LastName;
y[k]=PersonalID;
k++;
}
void::employee::get_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}
void::employee::gett_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}
int main()
{
//——-defining variables and initializing them————-
HRM info ;
int c;
char operation,ch;
//——–Printing my name on screen—————-
cout<<        “Welcome to the  program 2.1 written by Your Name”<<endl;
cout<<“**************************************************************************”<<endl;
cout<<endl<<endl<<endl;
do
{
cout<<“Welcome to Human Resource Management (HRM) Software of Company XYZ.”;
cout<<“To do specific task please choose one of the following commands.”<<endl<<endl<<endl;
cout<<”    1. Add new employee”<<endl;
cout<<”    2. Delete employee information”<<endl;
cout<<”    3. Update employee information”<<endl;
cout<<”    4. Make reports based on specific field”<<endl;
cout<<”    5. Search employee”<<endl;
cout<<”    6. Quit”<<endl<<endl;
while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
switch(c)
{
case 1:
cout<<“\nEnter the information of the new employee”<<endl;
info.AddPerson();
break;
case 2:
info.DeletePerson();
break;
case 3:
cout<<“\nEnter an item to deletion”;
info.UpdatePerson();
break;
case 4:
cout<<“\nEnter an element to search”;
info.ReportList();
break;
case 5:
info.SearchPerson();
break;
default :
cout<<“\nInvalid option try again”;
}
cout<<“\ndo u want to continue”;
cin>>ch;
}
while(ch==’y’||ch==’Y’);
system(“pause”);
return 0;
}

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
1
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
#include<iostream>
#include<math.h>
#include<cstdlib>
#include<string>

using namespace std;

class Person
{
private :

string FirstName;     // student name, max 49 characters
string LastName;      // student family name
int PersonalID ;
double salaryary ;
double WorkingHours ;
double CostPerHour ;

public :

void set_FieldName();
void get_FieldName();
void gett_FieldName();
void set_PersonalID();
void set_Name();
void LastNamesortList();
void in_input_firstname();
void in_family_name();
void in_Workinghour();
void in_Costperhour();
};

class HRM
{
private :

employeee[100] ;
employeetemp[100];
public :

void AddPerson();
void DeletePerson();
void SearchPerson();
void UpdatePerson();
void ReportList();

};

////global variables declared
int n=0,i=0,x=8248001,y[100];
bool flag=0;
int  z[100];
string h[100];
double salary[100];
int check=0;

/////////////////////////////////////////////////////////////////////
//      Definition of the AddPerson() method of the Company class
//      This method will add an employee to the Company class instance.
//      The attributes of the employee should be those of the user’s
//      own choosing.

void ::HRM::AddPerson() {

int x;
char redom;

do
{
n++;
e[i].set_FieldName();
i++;

cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
//cout<<“naaaaaaaaaaaam”<< n<<endl;
for(int i=0; i<n; i++){
e[i].get_FieldName();
}

cout<<“do u wont to add another employee”<<endl;
cin>>redom;
}
while((redom==’y’||redom==’Y’));

}

/////////////////////////////////////////////////////////////////////
//      Definition of the DeletePerson() method of the Company class.
//      This method will delete the employee of the user’s choosing from
//      the Company class instance.

void HRM::DeletePerson() {
//      Show all of the current employees
//      Ask the user the ID of which employee that they wish to
//      delete.

int Id;
bool lol;
char redomm1,redomm2;
lol =false;
lebel:
cout << “ID of employee to remove: “;

while(!(cin>>Id))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

for ( i = 0; i < n; ++i) {

if (y[i]==Id) {
e[i]=e[i+1];
lol=true;
e[i].set_Name();
cin>>redomm2;
if(redomm2==’Y’||redomm2==’y’){
int a;
a=n;

cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<a; i++){

e[i].get_FieldName();
cout<<“hahahahah=”<<n<<endl;
a–;
n=a;
n++;
}

///      goto lebel1;
}

cout <<endl;

//Delete function
}

}

if (lol==false) {
cout<<“Sorry, there is not any employee with requested personal number.”
<<” Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
cout<<endl<<endl;
}
}

//      Delete the chosen employee from the array of employees
//      as represented in this class.

// Actually remove the entry from memory so as to not leak objects
//nextIndex–;

}
/////////////////////////////////////////////////////////////////////
//      Definition of the UpdatePerson() method of the Company class
//      This method will modify an attribute of the employee in
//      the Company class instance. The employee and attribute should be
//      ones of the user’s own choosing.
void HRM::UpdatePerson(){

int Id;
char redomm1,redomm2;

lebel:
cout << “ID of employee to modify data: “;

while(!(cin>>Id))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

int flag1=0;
for (int i = 0; i < n; ++i) {

if (y[i]!=Id) {
flag1++;

}
}
/*  if (flag1==n){

// cout<<” not     matching=”<< y[i];
cout<<“Sorry, there is not any employee with requested personal number. Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
}
} */

cout <<endl;
lebel1:

for (int i = 0; i < n; ++i) {

if (y[i]==Id) {

cout<<“matching=”<< y[i];

flag=true;
int choice = 0;
char redom;

do {
cout << endl << endl;
cout << “Please enter the related number of field which you would like to update” << endl;
cout <<“1. First name” << endl;
cout << “2. Family name” << endl;
cout << “3. Working hours per week” << endl;
cout << “4. Payment for one hour” << endl;
cout << std::endl;

cin >> choice;
if (choice == 1) {
cout << ” First name: “;
e[i].in_input_firstname();
}
else if (choice == 2) {
cout << ” Family name: “;
e[i].in_family_name();
}
else if (choice == 3) {
cout << ” Working hours per week: “;
e[i].in_Workinghour();
}
else if (choice == 4) {
cout << ” Payment for one hour: “;
e[i].in_Costperhour();
}
cout<<“Do you want to update another field (Y/N)=”;
cin>>redom;
} while (redom==’y’||redom==’Y’);
}
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<a; i++){
e[i].get_FieldName();

cout<<“hahahahah=”<<n<<endl;

}
}

void ::Person::in_input_firstname()
{
cin>>input_firstname ;
}
void::Person::in_family_name()
{
cin>>LastName;
}
void::Person::in_Workinghour()
{
cin>>WorkingHours;
salaryary=WorkingHours*CostPerHour*52;
}
void::Person::in_Costperhour()
{
cin>>CostPerHour;
salaryary=WorkingHours*CostPerHour*52;
}

void HRM::ReportList() {

char op;
bool doMore;
cout<<“\nPlease enter the related number of the field which you would like to sort the list based on it.\n(1. Family name, 2.salaryary)?\n”<<endl;
//cin>>op;
while(!(cin>>op))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

switch(op)
{
case ‘1’:
cout<<“\nSorting based on Family Name\n”<<endl;
for(int i=0;i<=n;i++)
{
for(int j=i+1;j<=n-1;j++)
{
if(h[i]>h[i+1])
{
temp[i]=e[i];
e[i]=e[j];
e[j]=temp[i];
}
}
}

for(int i=0;i<n;i++)
{
e[i].get_FieldName();
}
cout<<“\nsorted\n”;

break;
case’2′:
cout<<“\nSorting based on salaryary\n”<<endl;
for(int h=0;h<n;h++)
{
for(int q=h+1;q<n;q++)
{
if(salary[h]>salary[h+1]);
{
temp[h]=e[h];
e[h]=e[q];
e[q]=temp[h];
}
}
}
for(int j=0;j<n;j++)
{
e[j].get_FieldName();
}
cout<<“\nsortedlist is printed above\n”;

break;
}
}

void HRM::SearchPerson(){
int c;
char redomm1;
string family_name;
double min,max;
do{
cout<<“Search is based on two different fields (1.family name, 2.salaryary), please enter your choice?=”<<endl;
//cin>>c;
while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

if(c==2)

{
cout<<“Please define your search range for salaryary of employees .”<<endl;
cout<<“What is minimum salaryary for search (S_min)?=”<<endl;
//cin>>min;
while(!(cin>>min))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“What is maximum salaryary for search (S_max)?=”<<endl;
//cin>>max;
while(!(cin>>max))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<n; i++) {

if (z[i]>min && z[i]<max) {

cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].gett_FieldName();
cout<<“matching=”<< z[i];
}
}

}

else if(c==1)
{
cout<<“Please enter the family name of employee?”<<endl;
cin>>family_name;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<n; i++) {

if (h[i]==family_name) {

cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].gett_FieldName();
cout<<“matching=”<< z[i];
}
}
}

cout<<“\nDo you want to Search any other field (y/n)?\n”<<endl;
cin>>redomm1;
}while(redomm1==’y’||redomm1==’Y’);

}

void ::Person::LastNamesortList() {
int temp2;
char temp,temp1;
}

void::employee::set_Name(){
cout<<“Do you really want to delete employee”<<FirstName<<“\t”<< LastName<< “(y/n)?:”;   //PersonalID=y[i];
}

int k=0;
void::employee::set_FieldName(){
PersonalID=x;
x++;
cout<<n;
cout<<“First Name=”;

while(!(cin>>FirstName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“Last Name=”;

while(!(cin>>LastName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

cout<<“How many hours a week is his/her work? =”;
;
while(!(cin>>WorkingHours))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“How much per hour is his/her salaryary? =”;

while(!(cin>>CostPerHour))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

salaryary=WorkingHours*CostPerHour*52;
z[i]= salaryary;
salary[i]=salaryary;
h[i]=LastName;
y[k]=PersonalID;

k++;
}

void::employee::get_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}

void::employee::gett_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}

int main()
{
//——-defining variables and initializing them————-

HRM info ;

int c;
char operation,ch;
//——–Printing my name on screen—————-
cout<<        “Welcome to the  program 2.1 written by Your Name”<<endl;
cout<<“**************************************************************************”<<endl;
cout<<endl<<endl<<endl;
do
{

cout<<“Welcome to Human Resource Management (HRM) Software of Company XYZ.”;
cout<<“To do specific task please choose one of the following commands.”<<endl<<endl<<endl;
cout<<”    1. Add new employee”<<endl;
cout<<”    2. Delete employee information”<<endl;
cout<<”    3. Update employee information”<<endl;
cout<<”    4. Make reports based on specific field”<<endl;
cout<<”    5. Search employee”<<endl;
cout<<”    6. Quit”<<endl<<endl;

while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
switch(c)
{
case 1:
cout<<“\nEnter the information of the new employee”<<endl;
info.AddPerson();
break;
case 2:
info.DeletePerson();
break;
case 3:
cout<<“\nEnter an item to deletion”;
info.UpdatePerson();
break;
case 4:
cout<<“\nEnter an element to search”;
info.ReportList();
break;
case 5:
info.SearchPerson();
break;
default :
cout<<“\nInvalid option try again”;

}
cout<<“\ndo u want to continue”;
cin>>ch;
}
while(ch==’y’||ch==’Y’);

system(“pause”);
return 0;
}mini-Project: Human Resource Management Program
इस प्रोजेक्ट मे एक कंपनी named ABC है और इस कंपनी मे दो डिपार्टमेंट है (1) : operation (2) : human resource department | इस प्रोजेक्ट मे HRD मे 100 employee के data को hold किया जाता है और इसे manage भी किया जाता है |
कंपनी ABC के HRD सॉफ्टवेर को बने गया है इसके निन्म operation को perform किया जाता है
1. Add new employee
2. Delete employee information
3. Update employee information
4. Make reports based on specific field
5. Search employee
6. Quit
इसमें class employeeको define किया जाता है | और इसके अलावा class HRD को भी define किया है | class employeeमे सभी वरिअब्क्ले को define किया जाता है और इसके  अलावा salaryary को calculate करते है | salaryary = “WorkingHours” * “CostPerHour” को calculate करते है |इसके अलावा इसमें निन्म function है :-

Class employeeshould include following private fields:
1.input_firstname (String) : ये employee के first name को hold करता है |
2.LastName (String) : ये employee के last name को hold करता  है |
3.PersonalID (Integer) : ये employee id को hold करता है |
4.salaryary (Double) : ये employee का सलरी है |
5.WorkingHours (Double) : ये working hour होता है |
6.CostPerHour (Double) : ये cost per hour की value को hold करता है |
class employeeमे public function होनी चाहिए जो की private variable को set और get करने के लिए किया जाता है |
1.set_FieldName()
2.get_FieldName()

“PersonalID” हमेशा unique और auto increament होता है | इसलिए PersonalID की value को कभी भी input नहीं करता है |
class HRM मे निन्म private variable होता है |
1. Array of employees with the type employee(Private)
class HRM मे निन्म public function होता है |
1. AddPerson()
2. DeletePerson(…)
3. UpdatePerson(…)
4. ReportList(…)
5. SearchPerson(…)

1. AddPerson()
इस function मे , employee की information को इनोपुत करा लेते है |
इसके लिए working per hour और payment per hour को input करा लेते है |
और इसके लिए salaryary को calculate करते है |
2. DeletePerson(…)
इस function मे , यूजर की information को डिलीट किया जाता है |
3. UpdatePerson(…)
इस function से employeeकी data को update किया जाता है |
4. ReportList(…)
इस function मे , employee के data को show किया जाता है |
5. SearchPerson(…)
इस function मे employee को data को search किया जाता है |
Solution-
#include<iostream>
#include<math.h>
#include<cstdlib>
#include<string>
using namespace std;
class Person
{
private :
string first ;     // student name, max 49 characters
string Last;      // student family name
int ID ;
double salaryary ;
double WH ;
double CPM ;
public :
void set_FieldName();
void get_FieldName();
void gett_FieldName();
void set_PersonalID();
void set_Name();
void LastNamesortList();
void input_firstname();
void in_lastName();
void in_wp();
void in_CPM();
};
class HRM
{
private :
employeee[100] ;
employeetemp[100];
public :
void Add_Person();
void Delete_Person();
void Search_Person();
void Update_Person();
void Report_List();
};
int n=0,i=0,x=8248001,y[100];
bool flag=0;
int  z[100];
string h[100];
double salary[100];
int check=0;
void ::HRM::AddPerson() {
int x;
char redomm;
do
{
n++;
e[i].set_FieldName();
i++;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<n; i++){
e[i].get_FieldName();
}
cout<<“do u wont to add another employee”<<endl;
cin>>redomm;
}
while((redomm==’y’||redomm==’Y’));
}
void HRM::DeletePerson() {
int Id;
bool lol;
char redomm1,redomm2;
lol =false;
lebel:
cout << “ID of employee to remove: “;
while(!(cin>>Id))
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
for ( i = 0; i < n; ++i) {
if (y[i]==Id) {
e[i]=e[i+1];
lol=true;
e[i].set_Name();
cin>>redomm2;
if(redomm2==’Y’||redomm2==’y’){
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<a; i++){
e[i].get_FieldName();
cout<<“hahahahah=”<<n<<endl;
a–;
n=a;
n++;
}
///      goto lebel1;
}
cout <<endl;
//Delete function
}
}
if (lol==false) {
cout<<“Sorry, there is not any employee with requested personal number.”
<<” Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
cout<<endl<<endl;
}
}
}
void HRM::UpdatePerson(){
int Id;
char redomm1,redomm2;
lebel:
cout << “ID of employee to modify data: “;
while(!(cin>>Id))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
int flag1=0;
for (int i = 0; i < n; ++i) {
if (y[i]!=Id) {
flag1++;
}
}
/*  if (flag1==n){
// cout<<” not     matching=”<< y[i];
cout<<“Sorry, there is not any employee with requested personal number. Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
}
} */
cout <<endl;
lebel1:
for (int i = 0; i < n; ++i) {
if (y[i]==Id) {
cout<<“matching=”<< y[i];
flag=true;
int choice = 0;
char redom;
do {
cout << endl << endl;
cout << “Please enter the related number of field which you would like to update” << endl;
cout <<“1. First name” << endl;
cout << “2. Family name” << endl;
cout << “3. Working hours per week” << endl;
cout << “4. Payment for one hour” << endl;
cout << std::endl;
cin >> choice;
if (choice == 1) {
cout << ” First name: “;
e[i].input_firstname();
}
else if (choice == 2) {
cout << ” Family name: “;
e[i].input_family_name();
}
else if (choice == 3) {
cout << ” Working hours per week: “;
e[i].input_Workinghour();
}
else if (choice == 4) {
cout << ” Payment for one hour: “;
e[i].input_Costperhour();
}
cout<<“Do you want to update another field (Y/N)=”;
cin>>redom;
} while (redom==’y’||redom==’Y’);
}
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<a; i++){
e[i].get_FieldName();
cout<<“hahahahah=”<<n<<endl;
}
}
void ::Person::input_firstname()
{
cin>>input_firstname ;
}
void::Person::in_family_name()
{
cin>>LastName;
}
void::Person::in_Workinghour()
{
cin>>WorkingHours;
salaryary=WorkingHours*CostPerHour*52;
}
void::Person::in_Costperhour()
{
cin>>CostPerHour;
salaryary=WorkingHours*CostPerHour*52;
}
void HRM::ReportList() {
char op;
bool doMore;
cout<<“\nPlease enter the related number of the field which you would like to sort the list based on it.\n(1. Family name, 2.salaryary)?\n”<<endl;
//cin>>op;
while(!(cin>>op))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
switch(op)
{
case ‘1’:
cout<<“\nSorting based on Family Name\n”<<endl;
for(int i=0;i<=n;i++)
{
for(int j=i+1;j<=n-1;j++)
{
if(h[i]>h[i+1])
{
temp[i]=e[i];
e[i]=e[j];
e[j]=temp[i];
}
}
}
for(int i=0;i<n;i++)
{
e[i].get_FieldName();
}
cout<<“\nsorted\n”;
break;
case’2′:
cout<<“\nSorting based on salaryary\n”<<endl;
for(int h=0;h<n;h++)
{
for(int q=h+1;q<n;q++)
{
if(salary[h]>salary[h+1]);
{
temp[h]=e[h];
e[h]=e[q];
e[q]=temp[h];
}
}
}
for(int j=0;j<n;j++)
{
e[j].get_FieldName();
}
cout<<“\nsortedlist is printed above\n”;
break;
}
}
void HRM::SearchPerson(){
int c;
char redomm1;
string family_name;
double min,max;
do{
cout<<“Search is based on two different fields (1.family name, 2.salaryary), please enter your choice?=”<<endl;
//cin>>c;
while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
if(c==2)
{
cout<<“Please define your search range for salaryary of employees .”<<endl;
cout<<“What is minimum salaryary for search (S_min)?=”<<endl;
//cin>>min;
while(!(cin>>min))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“What is maximum salaryary for search (S_max)?=”<<endl;
//cin>>max;
while(!(cin>>max))
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);
// whichever comes first.
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;

for(int i=0; i<n; i++) {
if (z[i]>min && z[i]<max) {
cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].gett_FieldName();
cout<<“matching=”<< z[i];
}
}
}
else if(c==1)
{
cout<<“Please enter the family name of employee?”<<endl;
cin>>family_name;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name :
Last Name :
Personal ID :
salaryary per year (Euros):       “;<<endl;
for(int i=0; i<n; i++) {
if (h[i]==family_name) {
cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].get_FieldName();
cout<<“matching=”<< z[i];
}
}
}
cout<<“\nDo you want to Search any other field (y/n)?\n”<<endl;
cin>>redomm1;
}while(redomm1==’y’||redomm1==’Y’);
}
void ::Person::LastNamesortList() {
int temp2;
char temp,temp1;
}
void::employee::set_Name(){
cout<<“Do you really want to delete employee”<<FirstName<<“\t”<< LastName<< “(y/n)?:”;   //PersonalID=y[i];
}
int k=0;
void::employee::set_FieldName(){
PersonalID=x;
x++;
cout<<n;
cout<<“First Name=”;
while(!(cin>>FirstName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“Last Name=”;
while(!(cin>>LastName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“How many hours a week is his/her work? =”;
;
while(!(cin>>WorkingHours))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“How much per hour is his/her salaryary? =”;
while(!(cin>>CostPerHour))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
salaryary=WorkingHours*CostPerHour*52;
z[i]= salaryary;
salary[i]=salaryary;
h[i]=LastName;
y[k]=PersonalID;
k++;
}
void::employee::get_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}
void::employee::gett_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}
int main()
{
//——-defining variables and initializing them————-
HRM info ;
int c;
char operation,ch;
//——–Printing my name on screen—————-
cout<<        “Welcome to the  program 2.1 written by Your Name”<<endl;
cout<<“**************************************************************************”<<endl;
cout<<endl<<endl<<endl;
do
{
cout<<“Welcome to Human Resource Management (HRM) Software of Company XYZ.”;
cout<<“To do specific task please choose one of the following commands.”<<endl<<endl<<endl;
cout<<”    1. Add new employee”<<endl;
cout<<”    2. Delete employee information”<<endl;
cout<<”    3. Update employee information”<<endl;
cout<<”    4. Make reports based on specific field”<<endl;
cout<<”    5. Search employee”<<endl;
cout<<”    6. Quit”<<endl<<endl;
while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
switch(c)
{
case 1:
cout<<“\nEnter the information of the new employee”<<endl;
info.AddPerson();
break;
case 2:
info.DeletePerson();
break;
case 3:
cout<<“\nEnter an item to deletion”;
info.UpdatePerson();
break;
case 4:
cout<<“\nEnter an element to search”;
info.ReportList();
break;
case 5:
info.SearchPerson();
break;
default :
cout<<“\nInvalid option try again”;
}
cout<<“\ndo u want to continue”;
cin>>ch;
}
while(ch==’y’||ch==’Y’);
system(“pause”);
return 0;
}

#include<iostream>
#include<math.h>
#include<cstdlib>
#include<string>

using namespace std;

class Person
{
private :

string FirstName;     // student name, max 49 characters
string LastName;      // student family name
int PersonalID ;
double salaryary ;
double WorkingHours ;
double CostPerHour ;

public :

void set_FieldName();
void get_FieldName();
void gett_FieldName();
void set_PersonalID();
void set_Name();
void LastNamesortList();
void in_input_firstname();
void in_family_name();
void in_Workinghour();
void in_Costperhour();
};

class HRM
{
private :

employeee[100] ;
employeetemp[100];
public :

void AddPerson();
void DeletePerson();
void SearchPerson();
void UpdatePerson();
void ReportList();

};

////global variables declared
int n=0,i=0,x=8248001,y[100];
bool flag=0;
int  z[100];
string h[100];
double salary[100];
int check=0;

/////////////////////////////////////////////////////////////////////
//      Definition of the AddPerson() method of the Company class
//      This method will add an employee to the Company class instance.
//      The attributes of the employee should be those of the user’s
//      own choosing.

void ::HRM::AddPerson() {

int x;
char redom;

do
{
n++;
e[i].set_FieldName();
i++;

cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
//cout<<“naaaaaaaaaaaam”<< n<<endl;
for(int i=0; i<n; i++){
e[i].get_FieldName();
}

cout<<“do u wont to add another employee”<<endl;
cin>>redom;
}
while((redom==’y’||redom==’Y’));

}

/////////////////////////////////////////////////////////////////////
//      Definition of the DeletePerson() method of the Company class.
//      This method will delete the employee of the user’s choosing from
//      the Company class instance.

void HRM::DeletePerson() {
//      Show all of the current employees
//      Ask the user the ID of which employee that they wish to
//      delete.

int Id;
bool lol;
char redomm1,redomm2;
lol =false;
lebel:
cout << “ID of employee to remove: “;

while(!(cin>>Id))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

for ( i = 0; i < n; ++i) {

if (y[i]==Id) {
e[i]=e[i+1];
lol=true;
e[i].set_Name();
cin>>redomm2;
if(redomm2==’Y’||redomm2==’y’){
int a;
a=n;

cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<a; i++){

e[i].get_FieldName();
cout<<“hahahahah=”<<n<<endl;
a–;
n=a;
n++;
}

///      goto lebel1;
}

cout <<endl;

//Delete function
}

}

if (lol==false) {
cout<<“Sorry, there is not any employee with requested personal number.”
<<” Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
cout<<endl<<endl;
}
}

//      Delete the chosen employee from the array of employees
//      as represented in this class.

// Actually remove the entry from memory so as to not leak objects
//nextIndex–;

}
/////////////////////////////////////////////////////////////////////
//      Definition of the UpdatePerson() method of the Company class
//      This method will modify an attribute of the employee in
//      the Company class instance. The employee and attribute should be
//      ones of the user’s own choosing.
void HRM::UpdatePerson(){

int Id;
char redomm1,redomm2;

lebel:
cout << “ID of employee to modify data: “;

while(!(cin>>Id))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

int flag1=0;
for (int i = 0; i < n; ++i) {

if (y[i]!=Id) {
flag1++;

}
}
/*  if (flag1==n){

// cout<<” not     matching=”<< y[i];
cout<<“Sorry, there is not any employee with requested personal number. Do you want to repeat delete by entering the new personal number (y/n)?:”;
cin>>redomm1;
if(redomm1==’Y’||redomm1==’y’){
goto lebel;
}
} */

cout <<endl;
lebel1:

for (int i = 0; i < n; ++i) {

if (y[i]==Id) {

cout<<“matching=”<< y[i];

flag=true;
int choice = 0;
char redom;

do {
cout << endl << endl;
cout << “Please enter the related number of field which you would like to update” << endl;
cout <<“1. First name” << endl;
cout << “2. Family name” << endl;
cout << “3. Working hours per week” << endl;
cout << “4. Payment for one hour” << endl;
cout << std::endl;

cin >> choice;
if (choice == 1) {
cout << ” First name: “;
e[i].in_input_firstname();
}
else if (choice == 2) {
cout << ” Family name: “;
e[i].in_family_name();
}
else if (choice == 3) {
cout << ” Working hours per week: “;
e[i].in_Workinghour();
}
else if (choice == 4) {
cout << ” Payment for one hour: “;
e[i].in_Costperhour();
}
cout<<“Do you want to update another field (Y/N)=”;
cin>>redom;
} while (redom==’y’||redom==’Y’);
}
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<a; i++){
e[i].get_FieldName();

cout<<“hahahahah=”<<n<<endl;

}
}

void ::Person::in_input_firstname()
{
cin>>input_firstname ;
}
void::Person::in_family_name()
{
cin>>LastName;
}
void::Person::in_Workinghour()
{
cin>>WorkingHours;
salaryary=WorkingHours*CostPerHour*52;
}
void::Person::in_Costperhour()
{
cin>>CostPerHour;
salaryary=WorkingHours*CostPerHour*52;
}

void HRM::ReportList() {

char op;
bool doMore;
cout<<“\nPlease enter the related number of the field which you would like to sort the list based on it.\n(1. Family name, 2.salaryary)?\n”<<endl;
//cin>>op;
while(!(cin>>op))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

switch(op)
{
case ‘1’:
cout<<“\nSorting based on Family Name\n”<<endl;
for(int i=0;i<=n;i++)
{
for(int j=i+1;j<=n-1;j++)
{
if(h[i]>h[i+1])
{
temp[i]=e[i];
e[i]=e[j];
e[j]=temp[i];
}
}
}

for(int i=0;i<n;i++)
{
e[i].get_FieldName();
}
cout<<“\nsorted\n”;

break;
case’2′:
cout<<“\nSorting based on salaryary\n”<<endl;
for(int h=0;h<n;h++)
{
for(int q=h+1;q<n;q++)
{
if(salary[h]>salary[h+1]);
{
temp[h]=e[h];
e[h]=e[q];
e[q]=temp[h];
}
}
}
for(int j=0;j<n;j++)
{
e[j].get_FieldName();
}
cout<<“\nsortedlist is printed above\n”;

break;
}
}

void HRM::SearchPerson(){
int c;
char redomm1;
string family_name;
double min,max;
do{
cout<<“Search is based on two different fields (1.family name, 2.salaryary), please enter your choice?=”<<endl;
//cin>>c;
while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

if(c==2)

{
cout<<“Please define your search range for salaryary of employees .”<<endl;
cout<<“What is minimum salaryary for search (S_min)?=”<<endl;
//cin>>min;
while(!(cin>>min))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“What is maximum salaryary for search (S_max)?=”<<endl;
//cin>>max;
while(!(cin>>max))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
int a;
a=n;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<n; i++) {

if (z[i]>min && z[i]<max) {

cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].gett_FieldName();
cout<<“matching=”<< z[i];
}
}

}

else if(c==1)
{
cout<<“Please enter the family name of employee?”<<endl;
cin>>family_name;
cout<<“\nThe employee with the following information has been added to the system:”<<endl;
cout<<“\nFirst Name       Last Name       Personal ID         salaryary per year (Euros)”;
cout<<“\n————–   ————–  ————       ————————-“<<endl;
for(int i=0; i<n; i++) {

if (h[i]==family_name) {

cout<<“naaaaaaaaaaaam”<< n<<endl;
e[i].gett_FieldName();
cout<<“matching=”<< z[i];
}
}
}

cout<<“\nDo you want to Search any other field (y/n)?\n”<<endl;
cin>>redomm1;
}while(redomm1==’y’||redomm1==’Y’);

}

void ::Person::LastNamesortList() {
int temp2;
char temp,temp1;
}

void::employee::set_Name(){
cout<<“Do you really want to delete employee”<<FirstName<<“\t”<< LastName<< “(y/n)?:”;   //PersonalID=y[i];
}

int k=0;
void::employee::set_FieldName(){
PersonalID=x;
x++;
cout<<n;
cout<<“First Name=”;

while(!(cin>>FirstName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“Last Name=”;

while(!(cin>>LastName))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a string!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

cout<<“How many hours a week is his/her work? =”;
;
while(!(cin>>WorkingHours))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
cout<<“How much per hour is his/her salaryary? =”;

while(!(cin>>CostPerHour))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}

salaryary=WorkingHours*CostPerHour*52;
z[i]= salaryary;
salary[i]=salaryary;
h[i]=LastName;
y[k]=PersonalID;

k++;
}

void::employee::get_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}

void::employee::gett_FieldName(){
cout<<FirstName<<“\t\t”<<LastName<<“\t\t\t”<<PersonalID<<“\t\t\t”<<salaryary<<“\t”<<endl;
}

int main()
{
//——-defining variables and initializing them————-

HRM info ;

int c;
char operation,ch;
//——–Printing my name on screen—————-
cout<<        “Welcome to the  program 2.1 written by Your Name”<<endl;
cout<<“**************************************************************************”<<endl;
cout<<endl<<endl<<endl;
do
{

cout<<“Welcome to Human Resource Management (HRM) Software of Company XYZ.”;
cout<<“To do specific task please choose one of the following commands.”<<endl<<endl<<endl;
cout<<”    1. Add new employee”<<endl;
cout<<”    2. Delete employee information”<<endl;
cout<<”    3. Update employee information”<<endl;
cout<<”    4. Make reports based on specific field”<<endl;
cout<<”    5. Search employee”<<endl;
cout<<”    6. Quit”<<endl<<endl;

while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
{
cout << “Please  enter a number!  Try again: “;
cin.clear ();
cin.ignore (1000, ‘\n’);  // Skip to next newline or 1000 chars,
// whichever comes first.
}
switch(c)
{
case 1:
cout<<“\nEnter the information of the new employee”<<endl;
info.AddPerson();
break;
case 2:
info.DeletePerson();
break;
case 3:
cout<<“\nEnter an item to deletion”;
info.UpdatePerson();
break;
case 4:
cout<<“\nEnter an element to search”;
info.ReportList();
break;
case 5:
info.SearchPerson();
break;
default :
cout<<“\nInvalid option try again”;

}
cout<<“\ndo u want to continue”;
cin>>ch;
}
while(ch==’y’||ch==’Y’);

system(“pause”);
return 0;
}