What kind of function do I need to used to change an employee's salary when given the old salary of the employee and the amount of increase for that employee (parameters).

(i.e. function with no return value and no parameter, function with no return value and call-by-value parameters, function with no return value and both call-by-value and call-by-reference parameters, or a function with return value and parameters, etc.

Thank you Much

Recommended Answers

All 3 Replies

Well, think about it. It says "when given the old salary of the employee and the amount of increase for that employee (parameters)". Half of the problem is already done for you.

why ? a function with parameters a return value

The function is going to take two parameters regardless of whether you pass by reference or by value. Regardless of whether you pass the salary by reference or value, I would pass the increase by value since you shouldn't change it. I would return a double if it was passed by value, and have it return a void if passed by reference:

void   IncreaseSalary (double& salary, double raise)   // by reference
double IncreaseSalary (double oldSalary, double raise)  // by value
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.