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:"<
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;
}
}
Step by step
Solved in 2 steps