c++小数运算

冷饮的价格 

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	
	float e;
	e = (2.5*a)+(1.5*b)-2.5; 
	
	cout<<fixed<<setprecision(1)<<e<<endl;
	return 0;
}

小明买水果

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	float a;
	cin>>a;
	
	int e;
	cin>>e;
	
	int t;
	t = a*e;
	 
	
	cout<<fixed<<setprecision(2)<<a<<endl;
	
	cout<<e<<endl;
	cout<<t<<endl;
	
	return 0;
}

1957

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a;
	cin>>b;
	cin>>c;
	
	float d;
	d = (a+b+c)%3;
	
	cout<<fixed<<setprecision(3)<<d<<endl;

	return 0;
}

1602

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int x,y,z;
	cin>>x;
	cin>>y;
	cin>>z;
	int a;
	a = x+y+z;
	
	double d =a%3;
	
	cout<<a<<endl;
	cout<<fixed<<setprecision(1)<<d<<endl;

	return 0;
}

1598

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int x,y,n;
	cin>>x;
	cin>>y;
	cin>>n;
	
	double o = n-(x+y)+0.1-0.1;
	
	cout<<x<<y<<n<<endl;
	cout<<fixed<<setprecision(1)<<o<<endl;

	return 0;
}


1601

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int x,a,z;
	cin>>x;
	a = x*3;
	z = a-8;
	
	float e;
	e =0.1+(x+a+z)/3-0.1; 
	
	cout<<a;
	
	cout<<z;
	
	cout<<fixed<<setprecision(2)<<e<<endl;
	
	return 0;
}

1005

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int a;
	cin>>a;
	
	double e =3.14*a*a; 
	double i =3.14*2*a;
	
	cout<<fixed<<setprecision(2)<<e<<endl;
	cout<<fixed<<setprecision(2)<<i<<endl;
	return 0;
}

1337

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	float e;
	cin>>e;
	
	float i =3.14*e*e;
	
	cout<<fixed<<setprecision(2)<<i<<endl;
	
	return 0;
}

1338

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int r1,r2;
	cin>>r1>>r2;
	
	float a =3.14*r1*r2;
	
	cout<<fixed<<setprecision(2)<<a<<endl;
	
	return 0;
}

1317

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int r1;
	cin>>r1;
	
	float a =(r1-2)*180;
	
	cout<<fixed<<setprecision(1)<<a<<endl;
	
	return 0;
}

1565

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值