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上編譯試試