更新时间:2023-02-12 14:11:39
问题是,math.h不工作,所以我必须使用cmath。第二,不是整数,而是浮点数或双精度。
The problem is that the math.h doesn't work, so I have to use cmath. Second, not int, but float or double.
代码:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float t1 = 3, t2 = 4, t3 = 5;
if (pow(t1, 2) + pow(t2, 2) == pow(t3, 2)) {
cout << "PT" << endl;
}
else {
cout << pow(t1, 2) + pow(t2, 2) << endl;
cout << pow(t3, 2) << endl;
}
}