每日一题4.1.2

快到碗里来

每日一题4.1.2
解题思路: 只需要比较周长和身长就好
容易踩坑: 半径和身长不能设为int型!!! 要设为double型!!!
代码实现:

#include <iostream>
using namespace std;
int Cat(double c,double r)
{
	if ((3.14 * 2 * r) > c)
		return 0;
	else
		return -1;
}
int main()
{
	double c, r;
	while (cin >> c >> r)
	{
		if (Cat(c, r) == 0)
			cout << "Yes" << endl;
		if (Cat(c, r) == -1)
			cout << "No" << endl;
	}
	system("pause");
	return 0;
}

相关文章:

  • 2021-09-18
  • 2021-09-25
  • 2021-11-28
猜你喜欢
  • 2022-02-17
  • 2021-11-19
  • 2021-12-21
  • 2021-08-23
  • 2021-08-02
  • 2021-05-22
相关资源
相似解决方案