晨曦到日暮 发表于 2018-1-8 10:54:02

c语言

#include<stdio.h>
int main()
{
        int a,b,c;
        double area,s;
        printf("输入三角形的三条边:");
        scanf("%d%d%d",a,b,c);
        s=(a+b+c)/2;
        area=sqrt(s(s-a)(s-b)(s-c));
        printf("三角形的面积公式为:");
        return 0;
}
第18题.cpp
H:\新建文件夹\第18题.cpp(9) : error C2065: 'sqrt' : undeclared identifier
H:\新建文件夹\第18题.cpp(9) : error C2064: term does not evaluate to a function
Error executing cl.exe.

被翻红浪 发表于 2018-1-8 10:58:31

本帖最后由 被翻红浪 于 2018-1-8 11:01 编辑

要使用sqrt必须#include <math.h> 还有就是要进行乘法应该是sqrt(s * (s - a) * (s - b) * (s - c))
页: [1]
查看完整版本: c语言