83分求助

P5717 【深基3.习8】三角形分类

实在找不到哪里有问题了。。。。。
by yuyuelong @ 2023-10-18 15:02:38


```cpp cout<<"Obtuse triangl" << endl; ``` 有问题。
by xiaoshumiao @ 2023-10-18 15:16:27


``` #include<bits/stdc++.h> using namespace std; int main(){ int a[6],A,B,C; cin>>a[0]>>a[1]>>a[2]; sort(a,a+3); A=a[0],B=a[1],C=a[2]; if(A+B<=C){ cout<<"Not triangle"; return 0; } if(A*A+B*B==C*C) cout<<"Right triangle"<<endl; if(A*A+B*B>C*C) cout<<"Acute triangle"<<endl; if(A*A+B*B<C*C) cout<<"Obtuse triangle"<<endl; if(A==B||B==C||A==C) cout<<"Isosceles triangle"<<endl; if(A==B&&B==C) cout<<"Equilateral triangle"<<endl; return 0; } ```
by China_Dream_Lucy @ 2023-10-18 15:16:33


等边三角形是特殊的等腰三角形 先判等边 不然会输出等边和等腰 还有钝角三角形拼错
by rewhtedfv @ 2023-10-18 15:17:41


谢谢各位大佬了,这个复制错了是我没想到的。。。。。
by yuyuelong @ 2023-10-18 15:33:17


|