#include <stdio.h>
#include <stdlib.h>
#include<windows.h>
#include<math.h>
int panduan(float a,float b,float c);
int main(){
float a,b,c;
float p,s;
printf("输入三个0时退出系统\n");
printf("\n");
scanf("%f,%f,%f",&a,&b,&c);
while(a!=0 && b!=0 && c!=0)//退出循环条件
{
if(panduan(a,b,c))//合法判断
{
p=(a+b+c)/2;
s=(float)sqrt((double)(p*(p-a)*(p-b)*(p-c)));
printf("面积为:%.2f\n",s);
}
else{
printf("%.2f,%.2f,%.2f,无法构成三角形,请重新输入!\n",a,b,c);
}
scanf("%f,%f,%f",&a,&b,&c);
}
system("pause");
return 0;
}
int panduan(float a,float b,float c){
if ( a + b > c && a + c > b && b + c > a)
return 1;
else
return 0;
}
#include <stdlib.h>
#include<windows.h>
#include<math.h>
int panduan(float a,float b,float c);
int main(){
float a,b,c;
float p,s;
printf("输入三个0时退出系统\n");
printf("\n");
scanf("%f,%f,%f",&a,&b,&c);
while(a!=0 && b!=0 && c!=0)//退出循环条件
{
if(panduan(a,b,c))//合法判断
{
p=(a+b+c)/2;
s=(float)sqrt((double)(p*(p-a)*(p-b)*(p-c)));
printf("面积为:%.2f\n",s);
}
else{
printf("%.2f,%.2f,%.2f,无法构成三角形,请重新输入!\n",a,b,c);
}
scanf("%f,%f,%f",&a,&b,&c);
}
system("pause");
return 0;
}
int panduan(float a,float b,float c){
if ( a + b > c && a + c > b && b + c > a)
return 1;
else
return 0;
}