[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Problemer med complex.h



"Preben H. Schmidt" wrote:

> Jeg sidder lige nu og forsoeger at faa C til at regne med komplekse tal

Jeg tror at du bruger C++

> for mig, men jeg kan ikke rigtig faa det til at fungere, og haaber
> derfor der er en eller anden der kan hjaelpe mig med det !!!

#include <iostream.h>
#include <complex>

extern "C++" {
  int main() {
    complex<double> c(3, 1);     //  c= (3, 1) is erroneous
    complex<double> cc(2, 4);    // cc= (2, 4) is erroneous
    complex<double> ccc= c * cc;

    cout << c << " " << cc << " " << ccc << endl;
    cout << real(c) << " " << imag(c) << endl;

    return 0;  // exposition only
  }
}

dette giver outputtet
(3, 1) (2, 4) (2, 14)
3 1
hvilket *er* korrekt.

Hvorfor din notation ikke har den ønskede effekt den har vil jeg vende
tilbage med.

> Paa forhaand tak for hjælpen !!!

Tak i lige måde!

> Dudde

Nils Åke Ljunggren.




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *