2023-04-15 Learning Record--C/C++-Mathematical Operations+Error-The parentheses before the obviously called expression must have a (pointer) function type

1、C/C++ Mathematics calculation ⭐️

1. Before using mathematical operations, you need to introducemath.h

#inclue<math.h>

Insert image description here

2. Some mathematical operations

Insert image description here

3. Examples

Insert image description here

Insert image description here
Corresponding code

#include <stdio.h>
#include <math.h> // 引入数学运算
int main()
{
    
    
    double a, b, c, s, area;                        // 自定义5个double型变量
    printf("请输入三角形的三边长,示例: 1,2,3 \n"); // 提示信息:提示用户输入
    scanf("%lf,%lf,%lf", &a, &b, &c);               // 用户输入(scanf里,double型对应%lf)
    s = (a + b + c) / 2;                            // 获取到s的值
    area = sqrt(s * (s - a) * (s - b) * (s - c));   // 利用题干公式,求出三角形的面积
    printf("三角形的面积为%f\n", area);            // 输出三角形的面积为?(printf里,double型对应%f; \n是换行符; \t是空格符)
    return 0;
}

Insert image description here

2.error-The parentheses before the expression that is obviously called must have a (pointer) function type ⭐️

1, bugas below:

Insert image description here

2. Analyze the reasons

You need to add a sign between multiplications*, otherwise the above error will be reported~

3. Correct writing

Insert image description here

Insert image description here

Guess you like

Origin blog.csdn.net/weixin_48850734/article/details/130172855