用c++的Switch语句算工资题目

麻烦帮忙看下,有哪位兄弟可以指导一下吗,谢了今晚就要截止了,看到的可以踢一下我

img

答案就在里面:
https://doc.docsou.com/b6c32facf2f44712324242962da3a872a74aceb4a.html

img

示例代码如下:
有帮助望采纳

#include <iostream>
using namespace std;
int main()
{
    int week, time;
    float result, tax;
    cin >> week >> time;
    switch (week)
    {
    case 6:
    case 7:

        result = time * 3 * 20 * (1 - 0.045);
        tax = time * 3 * 20 * 0.045;
        break;

    default:

        result = time * 20 * (1 - 0.045);
        tax = time * 20 * 0.045;
        break;
    }
    cout << result << ' ' << tax;
}

踢。 请问你会用 if else 写么? 请看这个帖子下面的 ’相关推荐‘, 就能解决你的问题。

感谢,鄙人以后一定好好学习编程,主要是人家上了一个月课我再插入去,有点匆忙了