Finding area/perimeter of triangle

In my assignment I have to find the area and the perimeter of a triangle with already given values for each side

a = 33.185
b = 21.23
c = 13.80

where area = squareroot of p(p-a)(p-b)(p-c)
and where p = (a+b+c)/2

however, I keep getting an area saying:

IntelliSense: expression preceding parentheses of apparent call must have (pointer-to-) function type

error C2064: term does not evaluate to a function taking 1 arguments



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iomanip>
#include <cmath>
#include <iostream>

using namespace std;

const double a = 33.19;
const double b = 21.23;
const double c = 13.80;


int main()
{
	double area;
	double p;

	p = (a + b + c) / 2.0;

	area = sqrt(p(p - a)(p - b)(p - c));

	cout << "The perimeter of the triangle is: " << p << endl;
	cout << "The area of the triangle is: " << area << endl;

	system("PAUSE");
	return 0;
}
sqrt(p(p - a)(p - b)(p - c));

To do multiplication in C++, you must use the *; you can't omit it like people often do in math formulas.
Ah how foolish of me, I was under the impression that it recognized it as a multiplication process.

Thank you!
Your multiplication in line 19 is in algebraic form.
As a result, the compiler sees p as a function.

area = sqrt(p*(p - a)*(p - b)*(p - c)); should fix it.
You need to include the asterisk for multiplication. Parenthesis don't do that.
Topic archived. No new replies allowed.