Euro to Schilling und umgekehrt



  • hallo there, i have written this small program because i have to present it to my teacher but i don't know what is wrong, i cannot compile it right, kann bitte jemand von euch helfen, bitte?

    1 EUR is equal 13.1 ATS ( österreich schilling )

    #include <iostream>
    using namespace std;

    int main ()
    {
    int ch;
    int x;
    int y;

    cout<<("Press 1 to convert from Euro to Schilling ! Press 2 to convert from Schilling to Euro ! ") ;

    cin >> ch;

    switch (ch)

    {

    case 1:
    cout <<" Type how much Euro would you like to convert"<< endl;
    cin >> x;
    cout<< "\n\n In Schilling is equal to "<<endl;
    cout<< 13.1 * x << endl;
    break;

    case 2:

    cout << ( "Please write how much Schilling to be converted in Euro" ) <<endl;

    cin >> y;

    cout<< "\n\In Euro it is " )<<endl;
    cout <<13.1/y <<endl;
    break;

    }

    return 0;

    }



  • Was genau funktioniert nicht?

    mfg
    v R



  • mein onlineparser sagt mir du hast hier ne klammer zuviel

    cout<< "\n\In Euro it is " )<<endl;
    

    wenn du die klammer killst hast du einen syntaxfehler weniger...



  • #include <iostream>
    using namespace std;
    
    int main ()
    {
    int ch;
    int x;
    int y;
    // Klammern weg.
    //cout<<("Press 1 to convert from Euro to Schilling ! Press 2 to convert from Schilling to Euro ! ") ;
    
    cout<< "Press 1 to convert from Euro to Schilling ! Press 2 to convert from Schilling to Euro ! "<< endl;
    
    cin >> ch;
    
    switch (ch)
    
    {
    
    case 1:
    cout <<" Type how much Euro would you like to convert"<< endl;
    cin >> x;
    cout<< "\n\n In Schilling is equal to "<<endl;
    cout<< 13.1 * x << endl;
    break;
    
    case 2:
    
    cout <<  "Please write how much Schilling to be converted in Euro" <<endl;
    
    cin >> y;
    
    cout<< "\n\n In Euro it is " << endl;
    if(y) // wenn y nicht 0 ist
    cout <<  13.1 / y  <<endl;
    else // wenn y 0 ist
    cout << cout <<  y  <<endl;
    break;
    
    }
    
    return 0;
    
    }
    

    Da



  • eViLiSSiMo schrieb:

    #include <iostream>
    using namespace std;
    
    int main ()
    {
    int ch;
    int x;
    int y;
    // Klammern weg.
    //cout<<("Press 1 to convert from Euro to Schilling ! Press 2 to convert from Schilling to Euro ! ") ;
    
    cout<< "Press 1 to convert from Euro to Schilling ! Press 2 to convert from Schilling to Euro ! "<< endl;
    
    cin >> ch;
    
    switch (ch)
    
    {
    
    case 1:
    cout <<" Type how much Euro would you like to convert"<< endl;
    cin >> x;
    cout<< "\n\n In Schilling is equal to "<<endl;
    cout<< 13.1 * x << endl;
    break;
    
    case 2:
    
    cout <<  "Please write how much Schilling to be converted in Euro" <<endl;
    
    cin >> y;
    
    cout<< "\n\n In Euro it is " << endl;
    if(y) // wenn y nicht 0 ist
    cout <<  13.1 / y  <<endl;
    else // wenn y 0 ist
    cout << cout <<  y  <<endl;
    break;
    
    }
    
    return 0;
    
    }
    

    Da

    danke, jetzt funktioniert super, schönen guten tag...



  • hallo there, i have written this small program because i have to present it to my teacher but i don't know what is wrong, i cannot compile it right, kann bitte jemand von euch helfen, bitte?

    Ist das nun als deutscher Text oder als englischer Text geplant gewesen?

    MfG SideWinder



  • Außerdem war der Umrechnungskurs doch ein anderer; 13.7603 IIRC...


Anmelden zum Antworten