6.2.3: Print functions.C++ ONLY
Define a function PrintEmployeeIncome() that takes one stringparameter and one integer parameter and outputs as follows, endingwith a newline. The function should not return any value.
Ex: If the input is Arturo 65000, then the output is:
CODE:
#include <iostream>using namespace std;
void PrintEmployeeIncome(string s, int n){ // Displaying the string and the integer cout <<"**"<<s<<"**\n"; cout << s << " earns " << n<< " dollars per year.\n";}
int main() { string employeeName; int employeeIncome;
cin >> employeeName; cin >> employeeIncome;
PrintEmployeeIncome(employeeName,employeeIncome);
return 0;}
Error:
X 1: Compare output Output differs. See highlights below. Special character legend Input Your output Expected output X 2: Compare output Input Your output Output differs. See highlights below. Special character legend Expected output X 3: Compare output Input Your output Expected output X 4: Compare output Output differs. See highlights below. Special character legend Input Your output Expected output X 5: Compare output Arturo 65000 **Arturo ** Arturo earns 65000 dollars per year. Input ** Arturo ** earns 65000 dollars per year. Your output Expected output Kjerstin 17600 Output differs. See highlights below. Special character legend **Kjerstin ** Kjerstin earns 17600 dollars per year. ** Kjerstin ** earns 17600 dollars per year. Mateo 74900 **Mateo** Mateo earns 74900 dollars per year. ** Mateo ** earns 74900 dollars per year. Ximena 53000 Output differs. See highlights below. Special character legend **Ximena ** Ximena earns 53000 dollars per year. ** Ximena ** earns 53000 dollars per year. Kai 8000 **Kai** Kai earns 8000 dollars per year. ** Kai ** earns 8000 dollars per year.
6.2.3: Print functions.C++ ONLY Define a function PrintEmployeeIncome() that takes one string parameter and one integer
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am