ex66104.cpp

来源:互联网 发布:防范网络电信诈骗 编辑:程序博客网 时间:2024/06/05 17:46
 /**************************************************************************
PURPOSE:    Compute salary
TIME: 08/10/25    18:24
AUTHOR:    ch8_daniel
INPUT:    hour  --------- working hours per week
              salary -------- salary per hour                
OUTPUT: week_salary -------- salary for one week
VERSION:    1.0
**************************************************************************/
 
#include <iostream>

using namespace std;

int main()
{
    float hours;
    float salary;
    float week_salary;
    const float h = 40;    // h is the separate line
    
    cout << "How many <hours> do you work a week ?";
    cin >> hours;
    cout << "And What's the salary per hour? ";
    cin >> salary;
    
    if (hours < h)
    {
        week_salary = salary * hours;        
    }
    else
    {
        week_salary = salary * h + salary * (1.5) * (hours - h);  
    }
    
    cout << "/n>>Your week-salary is " << week_salary << endl;
    
    return 0;
}