📄 计算员工周工资.cpp
字号:
// 计算员工周工资.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
float worktime,hmoney,total=0;
cin>>worktime>>hmoney;
if(worktime>60)
{
total += ((worktime - 60)*3+20*1.5+40)*hmoney;
}
else
{
if(worktime>40)
{
total += ((worktime-40)*1.5+40)*hmoney;
}
else
{
total += worktime*hmoney;
}
}
if(worktime>0&&worktime<=168)
{
cout<<total<<endl;
}
else
{
cout<<"input is wrong!"<<endl;
}
return 0;
}
/*
计算员工周工资
Time Limit:1000MS Memory Limit:65536K
Total Submit:125 Accepted:42
Description
编写一个程序,输入某雇员的每周工作时间(以小时计)和每小时的工资数,计算并输出他的工资。
(如果时间小于0或大于一周的从时间输出input is wrong!)
Input
输入工作时间和每小时的工资(只输入一组测试数据)
Output
总的薪金
Sample Input
30 4
45 4.5
60 5
-10 4
Sample Output
120
213.75
350
input is wrong!
Hint
若雇员周工作小时超过40 小时,则超过部分按原工资的1.5 倍的加班工资来计算,
若雇员每周工作小时超过60 小时,则超过60 的部分按原工资的3 倍的加班工资来计算,
而40 到50 小时的工资仍按照原工资的1.5 倍的加班工资来计算。
Source
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -