You are on page 1of 3

#include<iostream>

#include<string>
Using namespace std;
Struct Employee
{
String name, dateOfBirth;
Int empID, salary;
};
Int menu();
Employee inputData();
Void displayData(Employee emp);
Int salaryIncrement(int salary);
Void main()
{
Employee emp;
Emp = inputData();
Int choice;
Do{
System(“cls”);
Choice = menu();
If (choice == 1){
displayData(emp);
}
Else if (choice == 2){
Emp.salary = salaryIncrement(emp.salary);
}
Else if (choice == 3){
Exit(0);
}
Else{
Cout << “Invalid choice” << endl;
}
System(“pause”);
} while (choice != 3);
}
Int menu(){
Int choice;
Cout << “Menu” << endl;
Cout << “1. Display data\n2. Salary Increment\n3. Exit” << endl;
Cout << “Enter choice: “;
Cin >> choice;
Return choice;
}
Employee inputData(){
Employee emp;
Cout << “Enter Name: “;
Getline(cin, emp.name);
Cout << “Enter EmpID: “;
Cin >> emp.empID;
Cout << “Enter Date of Birth: “;
Cin >> emp.dateOfBirth;
Cout << “Enter Salary: “;
Cin >> emp.salary;
Return emp;
}
Void displayData(Employee emp){
Cout << “Name: “ << emp.name << endl;
Cout << “EmpID: “ << emp.empID << endl;
Cout << “Date of birth: “ << emp.dateOfBirth << endl;
Cout << “Salary: “ << emp.salary << endl;
}
Int salaryIncrement(int salary)
{
If (salary > 50000)
{
Salary = salary + (salary*(0.25));
Cout << “Salary update to: “ << salary << endl;
}
else
{
Salary = salary + (salary*(0.50));
Cout << “Salary update to: “ << salary << endl;
}
Return salary;
}

You might also like