c语言某商场营业员的总工资由两部分组成:基本工资和营业额提成费。设计算法并编写程序,输入基本工资(B)、本月的营业额(S)和营业额提成的比例(P),计算实发工资(T=B+S*P)。
时间: 2023-05-18 14:03:37 浏览: 161
以下是 CSDN 开发的 C知道的回答:
您好,以下是计算实发工资的 C 语言程序:
```c
#include <stdio.h>
int main() {
float basic_salary, sales, commission_rate, total_salary;
printf("请输入基本工资:");
scanf("%f", &basic_salary);
printf("请输入本月的营业额:");
scanf("%f", &sales);
printf("请输入营业额提成的比例:");
scanf("%f", &commission_rate);
total_salary = basic_salary + sales * commission_rate;
printf("实发工资为:%.2f\n", total_salary);
return 0;
}
```
如果您有更多的问题,请随时提出。
相关问题
C语言编写程序,向计算机输入4名职工的职工编号、职工姓名、基本工资和津贴工资等,并输出职工工资表
以下是一个简单的 C 语言程序,实现了输入4名职工信息并输出工资表的功能:
```c
#include <stdio.h>
struct employee {
int id;
char name[20];
float basic_salary;
float allowance;
float total_salary;
};
int main() {
struct employee emp[4];
int i;
// 输入职工信息
for (i = 0; i < 4; i++) {
printf("请输入第%d名职工的职工编号、职工姓名、基本工资和津贴工资:\n", i+1);
scanf("%d %s %f %f", &emp[i].id, emp[i].name, &emp[i].basic_salary, &emp[i].allowance);
// 计算总工资
emp[i].total_salary = emp[i].basic_salary + emp[i].allowance;
}
// 输出工资表
printf("\n职工工资表:\n");
printf("职工编号\t职工姓名\t基本工资\t津贴工资\t总工资\n");
for (i = 0; i < 4; i++) {
printf("%d\t\t%s\t\t%.2f\t\t%.2f\t\t%.2f\n", emp[i].id, emp[i].name, emp[i].basic_salary, emp[i].allowance, emp[i].total_salary);
}
return 0;
}
```
在程序中,我们定义了一个结构体 `employee`,表示职工信息,包括职工编号、职工姓名、基本工资、津贴工资和总工资。接着,在 `main` 函数中,我们定义了一个 `emp` 数组,用于存储4名职工的信息。然后,通过 `for` 循环,输入4名职工的信息,并计算出总工资。最后,再通过 `for` 循环,输出职工工资表。
注意,这只是一个简单的示例程序,实际的工资表可能会更加复杂,需要根据具体情况进行调整。
帮我写一个计算月收入的c语言程序需要输入月基本工资和月提成
好的,我可以回答这个问题。以下是计算月收入的C语言程序:
#include <stdio.h>
int main() {
float basic_salary, commission, total_income;
printf("请输入月基本工资:");
scanf("%f", &basic_salary);
printf("请输入月提成:");
scanf("%f", &commission);
total_income = basic_salary + commission;
printf("月收入为:%.2f\n", total_income);
return ;
}
希望能帮到您!
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)