<%@ page contentType="text/html; charset=gb2312"
pageEncoding="utf-8"%>
<html><body bgcolor=cyan><font size=3>
<form action="" method=post name=form>
<p>请你输入a:<input type="text" name="a" >
<br><p>请你输入b:<input type="text" name="b" >
<br><p>请你输入c:<input type="text" name="c" >
<br><input type="submit"value="提交"name=submit >
</form>
<%
String str_a=request.getParameter("a");
String str_b=request.getParameter("b");
String str_c=request.getParameter("c");
double a=0,b=0,c=0;
%>
<%
if(str_a==null)
str_a="0";
str_b="0";
str_c="0";
%>
<%
try{
a=Double.valueOf(str_a).doubleValue();
b=Double.valueOf(str_b).doubleValue();
c=Double.valueOf(str_c).doubleValue();
if(a+b>c&&a+c>b&&b+c>a){
double p=(a+b+c)/2.0;
double mainji=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.print("<br>"+"三角形面积:"+mainji);
}
else
out.print("<br>"+"不能构成三角形");
}
catch(NumberFormatException e){
out.print(e);
}
%>
</font></body></html>qq_杀意隆_0