系統呼叫了 abort 函式! *** stack smashing detected ***: terminated Aborted (core dumped)
#include <bits/stdc++.h>using namespace std;int main(){int a,b,c,i[2],h,r;cin >> i[0] >> i[1] >> i[2];int s=sizeof(i)/sizeof(i[0]);sort(i,i+s);a=i[0],b=i[1],c=i[2];h=a*a+b*b;r=c*c;cout << a << " " << b << " " << c << '\n';if(a+b<=c){cout << "No\n";return 0;}if(h==r) cout << "Right\n";else cout << (h>r ? "Acute\n":"Obtuse\n");return 0;}
你的陣列只開兩格...