Please enable java script to visit.
NOTEBOOK
HOMEPHP / MySQLJS / HTMLWXappPythonC++Blender其他
判断三角形 - NOTEBOOK
判断三角形
C++
Posted on 2023-08-02
摘要 : 使用 if...else 来判断。
描述:给你3条线段长度,请你判断
1:是否能组成等边三角形,如果能请输出‘yse’不能输出‘no’;
2:是否能组成等腰三角形,如果能请输出‘yse’不能输出‘no’;
3:是否能组成三角形,如果能请输出‘yse’不能输出‘no’;

输入:一行3个整数 a,b,c 。
输出:3行,第i行对应第i个问题。



#include<iostream>
using namespace std;
int main() {
int x,y,z;
cin >>x>>y>>z;

if(x==y && x==z){
cout<<"yse"<<endl;
}else{
cout<<"no"<<endl;
}
if(x==y || x==z || y==z){
cout<<"yse"<<endl;
}else{
cout<<"no"<<endl;
}
if(x+y>z || x+z>y || y+z>x){
cout<<"yse"<<endl;
}else{
cout<<"no"<<endl;
}

return 0;
}