88 lines
2.2 KiB
Markdown
88 lines
2.2 KiB
Markdown
### 作业1
|
||
|
||
| 薪水 | 涨薪幅度 |
|
||
| --------------- | -------- |
|
||
| 0-400.00 | 15% |
|
||
| 400.01-800.00 | 12% |
|
||
| 800.01-1200.00 | 10% |
|
||
| 1200.01-2000.00 | 7% |
|
||
| 超过 2000.00 | 4% |
|
||
|
||
读取员工的工资,计算并输出员工的新工资,以及员工增加的收入和涨薪幅度。
|
||
|
||
```c
|
||
#include <stdio.h>
|
||
|
||
int main() {
|
||
double money;
|
||
scanf("%lf", &money);
|
||
if (0 < money && money <= 400) {
|
||
printf("涨工资后,工资为:%lf\n", money * 1.15);
|
||
printf("涨工资幅度是15%%\n");
|
||
printf("涨了%lf元工资\n", money * 0.15);
|
||
}
|
||
if (400 < money && money <= 800) {
|
||
printf("涨工资后,工资为:%lf\n", money * 1.12);
|
||
printf("涨工资幅度是12%%\n");
|
||
printf("涨了%lf元工资\n", money * 0.12);
|
||
}
|
||
if (800 < money && money <= 1200) {
|
||
printf("涨工资后,工资为:%lf\n", money * 1.1);
|
||
printf("涨工资幅度是10%%\n");
|
||
printf("涨了%lf元工资\n", money * 0.1);
|
||
}
|
||
if (1200 < money && money <= 2000) {
|
||
printf("涨工资后,工资为:%lf\n", money * 1.07);
|
||
printf("涨工资幅度是7%%\n");
|
||
printf("涨了%lf元工资\n", money * 0.07);
|
||
}
|
||
if (2000 < money) {
|
||
printf("涨工资后,工资为:%lf\n", money * 1.04);
|
||
printf("涨工资幅度是4%%\n");
|
||
printf("涨了%lf元工资\n", money * 0.04);
|
||
}
|
||
return 0;
|
||
}
|
||
```
|
||
|
||
### 作业2
|
||
|
||
```
|
||
零食种类 价格
|
||
零食 1 R$ 4.00
|
||
零食 2 R$ 4.50
|
||
零食 3 R$ 5.00
|
||
零食 4 R$ 2.00
|
||
零食 5 R$ 1.50
|
||
```
|
||
|
||
现在给定某种零食的编号和数量,请你计算总价值是多少。
|
||
|
||
输入包含两个整数 x 和 y,其中 x 为零食编号,y 为零食数量。
|
||
|
||
```c
|
||
#include <stdio.h>
|
||
|
||
int main() {
|
||
int x, y;
|
||
scanf("%d%d", &x, &y);
|
||
if (x == 1) {
|
||
printf("Total: R$ %.2lf", 4.0 * y);
|
||
}
|
||
if (x == 2) {
|
||
printf("Total: R$ %.2lf", 4.5 * y);
|
||
}
|
||
if (x == 3) {
|
||
printf("Total: R$ %.2lf", 5.0 * y);
|
||
}
|
||
if (x == 4) {
|
||
printf("Total: R$ %.2lf", 2.0 * y);
|
||
}
|
||
if (x == 5) {
|
||
printf("Total: R$ %.2lf", 1.5 * y);
|
||
}
|
||
return 0;
|
||
}
|
||
```
|
||
|