调试下这个C++程序。

来源:百度知道 编辑:UC知道 时间:2024/04/24 04:09:11
//exc2.3-3.cpp
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Please input each length of the trilateral:";
cin>>a>>b>>c;
if((a+b>c)&&(b+c>a)&&(c+a>b))
{
if((a==b||b==c||c==a))!((a==b&&b==c))
;cout<<"It is a isocceles trilateral";
else if(a==b&&b==c)
cout<<"It is a equilateral trilateral";
else
cout<<"It is a general triteral";
}
else
cout<<"It's not a trilateral."<<endl;
return 0;
}
//编译后提示--------------------Configuration: Cpp3 - Win32 Debug--------------------
Compiling...
Cpp3.cpp
E:\C++程序\Cpp3.cpp(12) : warning C4552: '!' : operator has no effect; expected operator with side-effect
E:\C++程序\Cpp3.cpp(13) : error C2181: illegal else without matching if
Error

看看哦
不过不要忘记加分
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Please input each length of the trilateral:";
cin>>a>>b>>c;
if((a+b>c)&&(b+c>a)&&(c+a>b))
{
if((a==b||b==c||c==a)&&(!(a==b&&b==c)))
cout<<"It is a isocceles trilateral";
else if(a==b&&b==c)
cout<<"It is a equilateral trilateral";
else
cout<<"It is a general triteral";
}
else
cout<<"It's not a trilateral."<<endl;
return 0;
}

#include<iostream>
using namespace std;
int main(){
int a,b,c;
cout<<"Please input each length of the trilateral:";
cin>>a>>b>>c;
if((a+b>c)&&(b+c>a)&&(c+a>b)){
if((a==b||b==c||c==a)){
if((a!=b)||(b!=c))<