用友OA漏洞liqun
时间: 2023-11-06 22:05:55 浏览: 48
很抱歉,我无法理解你的问题。你可以提供更多的信息或者重新提问吗?
#### 引用[.reference_title]
- *1* *2* *3* [12.28---Convergence analysis of some algorithms for solving nonsmooth equations(LiQun Qi)](https://blog.csdn.net/qq_43884228/article/details/128464801)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关问题
c语言. 使用结构数组存放下表中的员工的工资数据,然后分别用结构体变量和结构指针输出每个员工的姓名及应发工资数。 应发工资=基本工资+岗位津贴-扣款 姓名 基本工资 岗位津贴 扣款 liqun dongfang majing liudong 870.00 1250.00 1520.00 2050.00 500.00 800.00 1000.00 1500.00 85.00 63.00 72.00 120.00
好的,为了方便处理,我先定义一个结构体表示员工的工资数据:
```c
struct Employee {
char name[20];
double basicSalary;
double positionAllowance;
double deduction;
};
```
然后,我们可以使用结构数组存放员工的工资数据:
```c
struct Employee employees[] = {
{"liqun", 870.00, 1250.00, 85.00},
{"dongfang", 1520.00, 500.00, 63.00},
{"majing", 800.00, 1000.00, 72.00},
{"liudong", 2050.00, 1500.00, 120.00}
};
```
接下来,我们可以分别使用结构体变量和结构指针输出每个员工的姓名及应发工资数:
```c
// 使用结构体变量输出每个员工的姓名及应发工资数
for (int i = 0; i < 4; i++) {
struct Employee employee = employees[i];
double salary = employee.basicSalary + employee.positionAllowance - employee.deduction;
printf("%s 的应发工资为 %.2lf 元。\n", employee.name, salary);
}
// 使用结构指针输出每个员工的姓名及应发工资数
for (int i = 0; i < 4; i++) {
struct Employee *employee = &employees[i];
double salary = employee->basicSalary + employee->positionAllowance - employee->deduction;
printf("%s 的应发工资为 %.2lf 元。\n", employee->name, salary);
}
```
输出结果如下:
```
liqun 的应发工资为 2035.00 元。
dongfang 的应发工资为 1957.00 元。
majing 的应发工资为 1728.00 元。
liudong 的应发工资为 3430.00 元。
liqun 的应发工资为 2035.00 元。
dongfang 的应发工资为 1957.00 元。
majing 的应发工资为 1728.00 元。
liudong 的应发工资为 3430.00 元。
```
使用结构数组存放下表中的员工的工资数据,然后用结构指针输出每个员工的姓名及应发工资数。 应发工资=基本工资+岗位津贴-扣款 姓名 基本工资 岗位津贴 扣款 liqun dongfang majing liudong 870.00 1250.00 1520.00 2050.00 500.00 800.00 1000.00 1500.00 85.00 63.00 72.00 120.00
好的,这是一个比较简单的结构体数组操作,可以按照以下步骤进行:
1. 定义结构体,包含姓名、基本工资、岗位津贴、扣款和应发工资字段。
```
struct Employee {
char name[20];
float basic_salary;
float position_allowance;
float deduction;
float gross_salary;
};
```
2. 定义结构体数组,初始化每个员工的数据。
```
struct Employee employees[] = {
{"liqun", 870.00, 500.00, 85.00},
{"dongfang", 1250.00, 800.00, 63.00},
{"majing", 1520.00, 1000.00, 72.00},
{"liudong", 2050.00, 1500.00, 120.00}
};
```
3. 计算每个员工的应发工资,并保存到结构体数组中。
```
for (int i = 0; i < 4; i++) {
float gross_salary = employees[i].basic_salary + employees[i].position_allowance - employees[i].deduction;
employees[i].gross_salary = gross_salary;
}
```
4. 定义结构指针,遍历结构体数组,输出每个员工的姓名和应发工资。
```
struct Employee *p;
for (p = employees; p < employees + 4; p++) {
printf("%s\t%.2f\n", p->name, p->gross_salary);
}
```
完整代码如下:
```
#include <stdio.h>
struct Employee {
char name[20];
float basic_salary;
float position_allowance;
float deduction;
float gross_salary;
};
int main() {
struct Employee employees[] = {
{"liqun", 870.00, 500.00, 85.00},
{"dongfang", 1250.00, 800.00, 63.00},
{"majing", 1520.00, 1000.00, 72.00},
{"liudong", 2050.00, 1500.00, 120.00}
};
for (int i = 0; i < 4; i++) {
float gross_salary = employees[i].basic_salary + employees[i].position_allowance - employees[i].deduction;
employees[i].gross_salary = gross_salary;
}
struct Employee *p;
for (p = employees; p < employees + 4; p++) {
printf("%s\t%.2f\n", p->name, p->gross_salary);
}
return 0;
}
```