2011-01-04 回答
#include
#include
#include
#include
#include
int main()
{
float a = 0.0;
float b = 0.0;
float c = 0.0;
float s = 0.0;
double area = 0.0;
while(true)
{
printf("input your date(a,b,c):");
scanf("%f%f%f",&a,&b,&c);
if(!isdigit((int)a) || !isdigit((int)b) || !isdigit(int(c)) || a + b <= c || a + c <= b || b + c <= a)
{
printf("your date is error!\n");
printf("Enter any key to continue...\n");
getch();
system("cls");
continue;
}
else
{
s = (a + b + c)/3;
area = sqrt(s * (s - a) * (s - b) * (s - c));
printf("the area is %-5.2f",area);
break;
}
}
return 0;
}
追问:
大哥,我不懂电脑,我是帮朋友问的,这是C语言代码吗,必须是C语言的代码哦。
追答:
当然是的 你可以在vc6上编译试试