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;


}

You really have 2 different main() programs that you are trying to compile as one unit. Split it up into two.

In the first file go from the headers to the first closing brace.

In the second file copy in just the headers (#include, etc), add in an int main() , copy in the stuff between your second set of braces and you're in business.

Please use code tags they will preserve spacing and put in line #s:

[code]

//code goes here //code goes here

[/code]

What if i need them to be in the same program, what should i do?

What if i need them to be in the same program, what should i do?

Figure out what you're trying to accomplish and think carefully about how you can put the code together into one file. It may mean a if() statement or two, and another question to the user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.