Functions

Good afternoon:

I am working on a code to use a function to determine circumference of a circle. The code I have so far is below. I keep getting error

Error 1 error C2447: '{' : missing function header (old-style formal list?)

Would anyone mind helping me with what this means? Thank you in advance.


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
27
28
29
30
31
32
33
34

//This program uses functions to find the circumference of a circle.
//Sam Bryant Lab6 CSE100

#include<iostream>
#include<cmath>
using namespace std;
double circumference();
int main()
{
	
	double radius;
	cout << "Please enter the radiuse of the circle." << endl;
	cin >> radius;

	double area = (3.14519*radius*radius);

	cout << "The area of the circle is " << area << endl;

	return 0;
}
{
	double circumference();
	{
		double circumference = (2 * 3.14159*radius);
		cout << "The circumference of the cirlce is " << circumference << endl;

		system("pause");
		return circumference;

	}

	}
Last edited on
The error message should contain also the line-number of offending syntax. I do presume that you do use IDE that even provides hyperlinks for your convenience.

I this case lines 22 and 33 make one ask: what is the purpose of these braces?


Once you have that resolved, you will get a different error. For that, please read:
http://www.cplusplus.com/doc/tutorial/functions/
Topic archived. No new replies allowed.