write alogrithms for the following  blocks of code... 1st block: void HRM::UpdatePerson(){ int empId; char redo1,redo2; lebel: cout << "ID of employee you are modifying: "; while(!(cin>>empId)) //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]!=empId) { 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>>redo1; if(redo1=='Y'||redo1=='y'){ goto lebel; } } */ cout <> choice; if (choice == 1) { cout << " First name: "; e[i].in_FirstName(); } else if (choice == 2) { cout << " Family name: "; e[i].in_FamilyName(); } 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>>redo; } while (redo=='y'||redo=='Y'); } } int a; a=n; cout<<"\nThe employee with the following information has been added to the system:"<

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section: Chapter Questions
Problem 1PP
icon
Related questions
Question

write alogrithms for the following  blocks of code...

1st block:

void HRM::UpdatePerson(){

int empId;
char redo1,redo2;

lebel:
cout << "ID of employee you are modifying: ";

while(!(cin>>empId)) //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]!=empId) {
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>>redo1;
if(redo1=='Y'||redo1=='y'){
goto lebel;
}
} */

cout <<endl;
lebel1:

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


if (y[i]==empId) {

cout<<"matching="<< y[i];

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

do {
cout << endl << endl;
cout << "Please enter the number related to the change you are trying to make: " << 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_FirstName();
}
else if (choice == 2) {
cout << " Family name: ";
e[i].in_FamilyName();
}
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>>redo;
} while (redo=='y'||redo=='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 Salary per year (USD)";
cout<<"\n-------------- -------------- ------------ -------------------------"<<endl;
for(int i=0; i<a; i++){
e[i].get_FieldName();

cout<<"hahahahah="<<n<<endl;

}
}

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT