+ 1

How to write a function argument program?

Write a program that has a function that takes a salary as an argument. If the salary is less than $20,000, give a 20% raise. Return the salary.

26th Oct 2017, 3:17 PM
Nae Codebell
2 odpowiedzi
+ 13
double raise(double salary) { if (salary<20000) { return salary*1.2; } return salary; }
26th Oct 2017, 3:20 PM
Valen.H. ~
Valen.H. ~ - avatar
0
#include<iostream> using namespace std; int func(int salary){ if (salary < 20000){ salary += (salary*20) / 100; return salary; } else { return salary; } } int main(){ int sal; cout<<"Enter your salary: "; cin>>sal; func(sal); return 0; }
26th Oct 2017, 3:27 PM
#RahulVerma
#RahulVerma - avatar