[try Beta version]
Not logged in

 
Area program with wrong output

Mar 23, 2014 at 11:45pm
solved
Last edited on Mar 24, 2014 at 1:21am
Mar 24, 2014 at 12:06am
it might be circle a (10.0); that's messing up you out put
and also, you might want to check, the math input,
make sure you have the right parenthesis, and the correct function
you might need to do something like a local call.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 

double circle::area(double i)
{
	return PI*(pow(radius,2));
}

int main ()
{
double i = 10.0
	circle a;
	circle b, c;

	b.set_radius(5.0);

	cout << " a' area is " << a.area(i) << endl;
Mar 24, 2014 at 12:42am
1) Careful when you copy paste (see lines 46-48 all outputting a.area())
2) What you show as expected out is circle circumference (2 pi r) and not the area (pi r^2).

Your code is correct apart from 1).
Mar 24, 2014 at 12:49am
KRAkatau


I'm an idiot. i was wondering why i was getting the same output. I swear im an idiot. Thanks bro
Topic archived. No new replies allowed.