Exponentialdarstellung



  • me again,

    hat jemand noch ne Idee, wie ich unter C++ eine Zahl in Exponentialdarstellung
    ausgebe? (also das Dingens mit dem "E" 😉 )

    unter C geht's glaub ich so:

    [code]
    include <stdio.h>

    int main()
    {
    const double pi = 3.1415926535
    printf("Pi: %E", pi);

    return 0;
    }
    /code]

    Bin mir jetzt nicht ganz sicher, ob des stimmt, aber Ihr wisst sicherlich, was ich meine... 😉

    thnx a lot!



  • Sowas à la

    const float meineLieblingsZahl = 16;
    std::cout.setf(std::ios::scientific, std::ios::floatfield);
    std::cout << meineLieblingsZahl;
    

    Aber das ist ein Standard-C++ Problem.
    edit: Sorry, ios nicht ios_base...

    [ Dieser Beitrag wurde am 18.04.2003 um 00:13 Uhr von nman editiert. ]


Anmelden zum Antworten