?? c14-1-2.cpp
字號:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{double triangle(double,double,double);
double a,b,c;
cin>>a>>b>>c;
try
{while(a>0 && b>0 && c>0)
{cout<<triangle(a,b,c)<<endl;
cin>>a>>b>>c;}
}
catch(double)
{cout<<"a="<<a<<",b="<<b<<",c="<<c<<",that is not a traingle!"<<endl;}
cout<<"end"<<endl;
return 0;
}
double triangle(double a,double b,double c)
{double s=(a+b+c)/2;
if (a+b<=c||b+c<=a||c+a<=b) throw a;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -