komplexe Zahlen



  • Hallo,
    ich steh auf dem Schlauch mit den komplexen Zahlen.
    Folgender Code:

    pragma hdrstop
    #include <condefs.h>
    #include <math.h>
    #include <iostream.h>
    #include <conio.h>

    //---------------------------------------------------------------------------
    #pragma argsused
    int main(int argc, char **argv)
    {
    complex a(1.0,1.0);

    cout<<abs(a);
    getch();
    return 0;
    }

    Ergebnis: Fehlermeldung:undefinded symbol 'complex'
    Wie soll das denn sonst gehen? Gibts ne Klasse für komplexe Zahlen?



  • Hallo

    also wenn du das Template aus der STL haben willst, schau mal in die BCB-Hilfe zu complex, da findest du ein Beispiel:

    #include <complex>
     #include <iostream>
     using namespace std;
     int main() 
     {
       complex<double> a(1.2, 3.4);
       complex<double> b(-9.8, -7.6);
       a += b;
       a /= sin(b) * cos(a);
       b *= log(a) + pow(b, a);
       cout << "a = " << a << ", b = " << b << endl;
       return 0;
     }
    

    bis bald
    akari



  • Alles klar, Leitung wieder frei...

    Vielen Dank!


Anmelden zum Antworten