sound用英文怎么读:调试下这个C++程序。

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 04:26:30
//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 executing cl.exe.

Cpp3.exe - 1 error(s), 1 warning(s)
试着给修改下,谢谢

看看哦
不过不要忘记加分
#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))
cout<<"It is a isocceles trilateral"<<endl;
else //if(a==b&&b==c)
cout<<"It is a equilateral trilateral"<<endl;
}
else cout<<"It is a general triteral"<<endl;
}
else cout<<"It's not a trilateral."<<endl;
system("pause");
return 0;
}