need some help with simple function implimenting code.

i am getting an:

unresolved external symbol "double_Cdecl getRaddius(void)" (?getRadius@@YANXZ) referenced in function_main

unresolved external symbol "double_Cdecl findCircumference(void)" (?getRadius@@YANXZ) referenced in function_main

unresolved external symbol "double_Cdecl findArea(void)" (?getRadius@@YANXZ) referenced in function_main


I am not sure where i am going wrong, but im sure its simple... Thanks!!!

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
using namespace std;
double getRadius();
double findArea();
double findCircumference();

int main()
{
	double radius;          //the radius of the circle
	double area;            //the area of the circle
	double circumference;   //the circumference of the circle

	//get the value of the radius from the user.. 
	radius = getRadius();

	//determine the area and circumference
	area = findArea();
	circumference = findCircumference();

	//output the results
	cout << "A circle of radius " << radius << " has an area of: " << area << endl;
	cout << "and a circumference of: " << circumference << endl;


	

	return 0;
}

double getRadius(double n)
{
	cout << "Please enter the radius of the circle: ";
	cin >> n;
	return n;
}

double findArea(double n)
{
	double area;
	area = 3.14159*n*n;
	return area;
}

double findCircumference(double n)
{
	double circumference;
	circumference = 2 * 3.14159*n;
	return circumference;
}
Your function prototype and the actual funtion is different, look at theiir parmeter
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
// using namespace std; // avoid, just use std::cout etc.

const double PI = 3.14159 ; // avoid magic numbers

double getRadius();

// double findArea();
double findArea( double radius ) ;

// double findCircumference();
double findCircumference( double radius );

int main()
{
	// double radius;          //the radius of the circle
	// double area;            //the area of the circle
	// double circumference;   //the circumference of the circle

	//get the value of the radius from the user..
	const double radius = getRadius(); // as far as possible, initialise at point of definition

	//determine the area and circumference
	// area = findArea();
	const double area = findArea(radius) ;

	// circumference = findCircumference();
	const double circumference = findCircumference(radius);

	//output the results
	std::cout << "A circle of radius " << radius << " has an area of: " << area
	          << "\nand a circumference of: " << circumference << '\n' ;
}

// double getRadius(double n)
double getRadius()
{
    double radius ; // *** added ***
	std::cout << "Please enter the radius of the circle: ";
	std::cin >> radius ; // n;
	return radius ; // n;
}

double findArea( double radius )
{
	const double area = PI * radius * radius ; // as far as possible, initialise at point of definition
	return area;
}

double findCircumference( double radius )
{
    return 2 * PI * radius ; // or return an anonymous result
}
thank you so much! this helped alot
Topic archived. No new replies allowed.