C3-1 直角三角形
(100/100 分数)
题目描述
输入一个三角形的3边长度,判断该三角形是否为直角三角形,若是则输出True,若不是则输出False。推荐做法:定义一个函数,接受三个int参数,返回bool,再用主函数调用之。
输入描述
每行输入三个由空格隔开的整数 a, b, c ,表示三角形的 3 条边长
1 <= a,b ,c <= 10000
输出描述
对于每一行输入,输出True或者False表明是否为直角三角形
/* students please write your program here */
#include <iostream>
#include <cmath>
using namespace std;
bool triangle(int a,int b, int c)
{
int a2,b2,c2;
a2=pow(a, 2);
b2=pow(b, 2);
c2=pow(c, 2);
if (a2+b2==c2||a2+c2==b2||b2+c2==a2)
return true;
else
return false;
}
int main(int argc, const char * argv[]) {
unsigned int a,b,c;
cin>>a>>b>>c;