Fill a glass with water (or what else) then drink, not vice versa ;)
Calculate a circle area AFTER its diameter request.
Output the area variable, not a wrong character literal 'area'...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
>gives me a wierd symbol for the area?
area is declared as a char, and cout is assuming you want to print a character rather than the integral value. Change char area; to int area; and you'll get a slightly more reasonable result.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>...why is this i cannot see anything wrong with my code...
Oh, this harmful Daniweb engine! I see 'area' in the OP snippet but area in the post #3 code ;)
By the way, change char area; to float area; ...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
Insert std::cin.ignore(1000,'\n'); after std::cin >> diameter;
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
I believe you still have a problem with the math?
Circumference = 2 .0 * PI * Radius;
Area = PI * Radius * Radius;
To borrow a very old math joke, "Pie aren't square, Pie are Round!"
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99