求助,玄关
查看原帖
求助,玄关
516738
gaoleng_luogu_name楼主2023/12/30 14:27

rt,想要实现判断一个数是否是有限小数,我写了这段代码。可是有问题。明明1/3,p=0.333333,b=3,为什么乘起来会变成1。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	float a,b;
	cin>>a>>b;
	cout<<a<<" "<<b<<endl;
	float p=a/b;
	cout<<p<<endl<<p*b;
	return 0;
}
2023/12/30 14:27
加载中...