## C and C++

Moderators: None (Apply to moderate this forum)
Number of posts: 94715

This Forum Only

subject area of cirlce. Posted by talhanasir on 1 Jun 2006 at 3:53 AM
what is meaning of double-precision in the following question?

Write a function that returns the double-precision area of a circle, given the double precision radius passed to it. The formula to calculate the radius of a circle is .

what will be the value of radius.?

and what will be the value of radius in above question?
Talha Nasir

Re: subject area of cirlce. Posted by HK_MP5KPDW on 1 Jun 2006 at 4:41 AM
: what is meaning of double-precision in the following question?
:
: Write a function that returns the double-precision area of a circle, given the double precision radius passed to it. The formula to calculate the radius of a circle is .
:
:
: what will be the value of radius.?

:
: and what will be the value of radius in above question?
: Talha Nasir
:
:

Use double variables as opposed to float for radius and area. How the heck do I know what the value of radius is going to be? I'm not clairvoyant/omniscient.
Re: subject area of cirlce. Posted by IDK on 1 Jun 2006 at 5:39 AM
: : what is meaning of double-precision in the following question?
: :
: : Write a function that returns the double-precision area of a circle, given the double precision radius passed to it. The formula to calculate the radius of a circle is .
: :
: :
: : what will be the value of radius.?

: :
: : and what will be the value of radius in above question?
: : Talha Nasir
: :
: :
: How the heck do I know what the value of radius is going to be? I'm not clairvoyant/omniscient.[/green]
:
With some math it should be:
Re: subject area of cirlce. Posted by zeolite on 1 Jun 2006 at 8:03 AM
That should be exactly what you need:
```double AreaOfCircle(double radius)
{
}```

: what is meaning of double-precision in the following question?
:
: Write a function that returns the double-precision area of a circle, given the double precision radius passed to it. The formula to calculate the radius of a circle is .
:
:
: what will be the value of radius.?

:
: and what will be the value of radius in above question?
: Talha Nasir
:
:
Re: subject area of cirlce. Posted by FDrache on 2 Jun 2006 at 9:08 AM
: That should be exactly what you need:
```double AreaOfCircle(double radius)
: {
: }```

:

That's it! And to be exact, define and take
const double pi = 2.0 * acos(0.0); // 2*arccosine(0)
because pi is usually not defined in C libraries.
FDrache.

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic