- 吐吐很快乐
To 法海 编程题1--3
- 2025-1-21 18:56:55 @
小数计算器
#include<bits/stdc++.h>
using namespace std;
double a,b;
int main() {
cin >> a >> b;
double h = a + b;
double m = a - b;
double j = a * b;
double z = a / b;
cout << fixed << setprecision(2);
cout << h << endl;
cout << m << endl;
cout << j << endl;
cout << z << endl;
return 0;
}
纳税
#include<bits/stdc++.h>
using namespace std;
int r;
int main()
{
cin >> r;
cout << fixed << setprecision(2);
if (r<2000)
{
cout << 0.2*r;
}
else if(r>=2000 && r<4000)
{
cout << 0.3*r;
}
else
{
cout << 0.5*r;
}
return 0;
}
商场购物
#include<bits/stdc++.h>
using namespace std;
int a,b,num,c[10000];
int main()
{
//大神,欢迎您在这里撸码~~
cin >> a >> b;
for(int i = 0;i<5;i++)
{
cin >> c[i];
if(b>=c[i])
{
b=b-c[i];
}
}
cout << b;
return 0;
}
0 条评论
目前还没有评论...