raisesal.cpp

来自「BigC++的源码」· C++ 代码 · 共 25 行

CPP
25
字号
#include <iostream>

using namespace std;

#include "ccc_empl.cpp"

/**
   Raise an employee salary 
   @param e employee receiving raise
   @param by the percentage of the raise
*/
void raise_salary(Employee& e, double by)
{  
   double new_salary = e.get_salary() * (1 + by / 100);
   e.set_salary(new_salary);
}

int main()
{  
   Employee harry("Hacker, Harry", 45000.00);
   raise_salary(harry, 5);
   cout << "New salary: " << harry.get_salary() << "\n";
   return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?