Macy
Macy

Reputation: 27

CS2064 "term does not evalute a function taking 1 argument"?

I've looked at other threads and they say "this or that is not a pointer!!!" I don't really know what that means, I have var s declared so what's not working here? We're writing a program to find the area of a square btw, this isn't the whole code either! Line 2 is where the error points too.

int s = ((line_one + line_two + line_three) / 2);
    int area = sqrt((s - line_one)(s - line_two)(s - line_three));

    cout << "The area of the triange is..." << area << endl;

Here's where I declare the other variables:

// Area of a Triangle

double x1 = 0;
double y1 = 0;
double x2 = 0;
double y2 = 0;
double x3 = 0;
double y3 = 0;
double x4 = 0;
double y4 = 0;
double x5 = 0;
double y5 = 0;
double x6 = 0;
double y6 = 0;

//line one points
cout << "enter point x1" << endl;
cin >> x1;
cout << "enter point y1" << endl;
cin >> y1;
cout << "enter point x2" << endl;
cin >> x2;
cout << "enter point y2" << endl;
cin >> y2;
const int line_one = sqrt((pow((x2 - x1), 2) + (pow((y2 - y1), 2))));

//line two points
cout << "enter point x3" << endl;
cin >> x3;
cout << "enter point y3" << endl;
cin >> y3;
cout << "enter point x4" << endl;
cin >> x4;
cout << "enter point y4" << endl;
cin >> y4;
const int line_two = sqrt((pow((x4 - x3), 2) + (pow((y4 - y3), 2))));

//line three points
cout << "enter point x5" << endl;
cin >> x5;
cout << "enter point y5" << endl;
cin >> y5;
cout << "enter point x6" << endl;
cin >> x6;
cout << "enter point y6" << endl;
cin >> y6;
const int line_three = sqrt((pow((x6 - x5), 2) + (pow((y6 - y5), 2))));
//Calculating the Area

int s = ((line_one + line_two + line_three) / 2);
int area = sqrt((s - line_one)(s - line_two)(s - line_three));

    cout << "The area of the triange is..." << area << endl;


return 0;
}

Upvotes: 0

Views: 98

Answers (1)

Kirkova
Kirkova

Reputation: 347

It's a simple mistake to make, you forgot to add * between the things you want to multiply in the sqrt() function call.

int s = ((line_one + line_two + line_three) / 2);
    int area = sqrt((s - line_one)*(s - line_two)*(s - line_three));

    cout << "The area of the triange is..." << area << endl;

Like that. It gave you the pointer error because it thought you were trying to call a function where for example, (s - line_one) would return a function pointer and (s-line_two) would be a parameter to that function.

Upvotes: 3

Related Questions