Write C++ program that reads salary of an employee and give him a promotion by m
ID: 3634116 • Letter: W
Question
Write C++ program that reads salary of an employee and give him a promotion by multiplying his/her salary value by a number. Write function promotion to make the multiplication.Note:
• After calling promotion (salary, number) function, the result should be stored in the salary variable itself. E.g. if the salary equal to 2000, after calling promotion (salary,3), salary will be equal to 6000 instead of 2000.
• If the user calls the function as promotion (salary), the salary will be doubled (i.e. multiplied by 2).
Explanation / Answer
please rate - thanks
#include <iostream>
using namespace std;
double promotion(double,int number=2);
int main()
{double salary=2000;
cout<<"triple Original salary of "<<salary<<" = "<<promotion(salary,3)<<endl;
cout<<"double Original salary of "<<salary<<" = "<<promotion(salary)<<endl;
system("pause");
return 0;
}
double promotion(double salary,int number)
{return salary*number;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.