Re: Complex Number Support
- From: Jon Evans <JonEvans@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 13 Jul 2005 00:55:01 -0700
"Victor Bazarov" wrote:
> Jon Evans wrote:
> > If someone could post the min num lines of code to
> > 1) Initialise a complex number
> > 2) Take it's square root
> > 3) AND list all the header files / .lib files needed
> In C++ you should do
> #include <complex>
> using std::complex;
>
> int main() {
> complex<double> cd(1,1); // initialise
> complex<double> sq = sqrt(cd); // take a square root
> }
>
> Everything should be the default.
Many thanks ! I now see my fundamental mistake was trying to include a
(non-existant) complex.h.
I had to mod the sqrt line by adding "std::" in front of the 'sqrt' - I only
mention this as having never used this kind of thing I thought I'd check that
this wasn't indicative of me having failed to do something else.
> MFC is a C++ library. If you need to confine yourself to the C language,
> then MFC is not an option.
The majority of the project is C++ (MFC) but contains core analysis
algorithms that are straight C (for portability reasons).
Thanks for pointing me in the right direction,
TTFN,
Jon
.
- Follow-Ups:
- Re: Complex Number Support
- From: Carl Daniel [VC++ MVP]
- Re: Complex Number Support
- References:
- Complex Number Support
- From: Jon Evans
- Re: Complex Number Support
- From: Victor Bazarov
- Complex Number Support
- Prev by Date: Re: Dr Watson Event Dump wrt VC6 map file
- Next by Date: Re: Is it a bad idea to introduce "Reference" in C++ ?
- Previous by thread: Re: Complex Number Support
- Next by thread: Re: Complex Number Support
- Index(es):