函数合理运用 + 分支结构
2023-07-27 18:40:28
发布于:浙江
14阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
bool tri(int a,int b,int c){
if(a+b>c and a+c>b and c+b>a and abs(a-b)<c and abs(a-c)<b and abs(b-c)<a){
return true;
}
else return false;
}
void out(int a,int b,int c){
if(a==b and b==c) cout<<"aaa";
else if(a==b or a==c or b==c) cout<<"aab";
else cout<<"abc";
return ;
}
int main(){
int a,b,c;cin>>a>>b>>c;if(!tri(a,b,c)){
cout<<"error";return 0;
}
out(a,b,c);
return 0;
}
这里空空如也
有帮助,赞一个