用三个变量分别代表不同含义,最后输出一下就可以
#include <iostream>
using namespace std;
int main()
{
double s;
cin >> s;
double x1,x2,x3;
if (s > 0 && s <= 400) {
x1 = s * (1 + 0.15);
x2 = s * 0.15;
x3 = 0.15 * 100;
} else if (400.01 <= s && s <= 800) {
x1 = s * (1 + 0.12);
x2 = s * 0.12;
x3 = 0.12 * 100;
} else if (800.01 <= s && s <= 1200) {
x1 = s * (1 + 0.1);
x2 = s * 0.1;
x3 = 0.1 * 100;
} else if (1200.01 <= s && s <= 2000) {
x1 = s * (1 + 0.07);
x2 = s * 0.07;
x3 = 0.07 * 100;
} else {
x1 = s * (1 + 0.04);
x2 = s * 0.04;
x3 = 0.04 * 100;
}
printf("Novo salario: %.2lf\n",x1);
printf("Reajuste ganho: %.2lf\n",x2);
printf("Em percentual: %.0lf %%\n",x3);
}
兄弟有时间填个邀请码hhhhhhhhh(可以得AC币,邀请码在学生认证那填) 我的邀请码是:GUDFH