Can you please tell me what's wrong? I get this error:
error C2447: '{' : missing function header (old-style formal list?)
//
// Area= 1/2 | (x1y2 - x2y1) + (x2y3 - x3y2) + (x3y1 - x1y3) |
// (distance)^2 = (x-difference)^2 + (y-difference)^2
// v= sqrt[ s(s-a)(s-b)(s-c) ]
// c^2= A^2 + B^2 - 2 A B cos Z
// Z = angle between A and B
// area of triangle = 1/2 AB sin Z
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x1, x2, x3, y1, y2, y3, Area;
cout << "Please enter the value of x1: ";
cin >> x1;
cout << "Please enter the value of y1: ";
cin >> y1;
cout << "Please enter the value of x2: ";
cin >> x2;
cout << "Please enter the value of y2: ";
cin >> y2;
cout << "Please enter the value of x3: ";
cin >> x3;
cout << "Please enter the value of y3: ";
cin >> y3;
Area = 0.5 * abs((x1*y2 - x2*y1) + (x2*y3 - x3*y2) + (x3*y1 - x1*y3));
cout << "Area is: " << Area << endl;
return 0;
}
{
float s, a, b, c, V, distance, x1, x2, x3, y1, y2, y3, perimeter;
cout << "Please enter x1: ";
cin >> x1;
cout << "Please enter x2: ";
cin >> x2;
cout << "Please enter x3: ";
cin >> x3;
cout << "Please enter y1: ";
cin >> y1;
cout << "Please enter y2: ";
cin >> y2;
cout << "Please enter y3: ";
cin >> y3;
a = sqrt( pow( (x2-x1, 2)) + pow((y2-y1, 2) ));
b = sqrt( pow( (x3-x2, 2)) + pow((y3-y2, 2) ));
b = sqrt( pow( (x3-x1, 2)) + pow((y3-y1, 2) ));
Perimeter = a + b + c;
s = Perimeter / 2;
V = sqrt ( s*(s-a)*(s-b)*(s-c) );
cout << "Area is: " << V << endl;
return 0;
}