Urgent please

...
Last edited on
Firstly, you must know that C++ is a case sensitive language.
Secondly,
radius = getradius();
maus change to something like radius = getradius(4);, The same issue for
void findarea(double&area,double radius)
and
void findArea(double&area);
!

You must have the same definition and declaration.
For the senstive case, I have done with this. But I didn't understand what you mean by the rest of mistakes.
These code:
1
2
3
int getRadius(double radius);
void findArea(double&area);
void findCircumference(double&Circumference);


and these functions:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
int getradius( double radius)
{

cin>>radius;
return radius;

}

void findarea(double&area,double radius)
{

area = 3.14159*radius*radius;
}
void findcircumference(double&circumference,double radius)
{

circumference = 2*3.14159*radius;
}


Must have the same parameters!
The other posters are giving good clues, but I would like to add another which is talking about the same things.

Hussain, you must understand what it means to send a value to a function, and also to return a value from a function. And understand how that affects the way you declare the function.

Put another way: the function declaration, the function call, and the return value must be consistent.

See if you can explain to us what returning void means.

We are all just trying to make you think about what you are doing. :)
...
Last edited on
In your int findarea(double&area) function, change it so that it takes the radius as a parameter instead.
Thanks, but how about int findcircumference(double&circumference)

should it have the same scenario?
The stuff inside the parentheses are the function's parameters. They are the variables that you give the function in order to enable the function to do its job.

Your "findcircumference" function doesn't need to know what circumference is; that's what it's supposed to tell you. But it does need to know what radius is in order to calculate the circumference for you.

The "int" in front of "findcircumference" is the return type of the function. Since it is an int, then the function returns an integer. But you need circumference to be a double, so you should change that int to double.
Topic archived. No new replies allowed.