c语言 三角形三边abc,C语言代码输入abc三个数,求一这3个数为边长的三角形面积...

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上编译试试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值