[c++ bzw. java] Überstzung

DarkSean

Erfahrenes Mitglied
Ich hab ein Programm geschrieben zum Lösen quadratischer Gleichungen. Da mein Handy Java unterstützt, möchte ich das gleiche Programm in Java haben. Wäre vielleicht jemand so nett und würde es für mich übersetzen und den übersetzten Sourcecode und ne .jar Datei hier reinstellen?
Hier der Code
Code:
// Copyright: © 2006 Oliver Sabiniarz
#include <iostream>
#include <math.h>
#include <conio.h>

long double a , b , c , side , a1 , c1 , b1 , b2 ;

using namespace std;

int main()
{
    for (int i = 1;i < 2;)
    {
    cout << "Quadratische Gleichungen mit quadratischer Erg" "\x84" "nzung l" "\x94" "sen" << endl 
         << "Copyright © 2006 Oliver Sabiniarz" << endl
         << "a x ^ 2 + b x + c = 0" << endl 
         << endl
         << " Bitte geben Sie a ein: ";
    cin  >> a;
    cout << endl
         << " Bitte geben sie b ein: ";
    cin  >> b;
    cout << endl
         << " Bitte geben Sie c ein: ";
    cin  >> c;
    cout << endl
         << endl;
    if (a != 1)
    {
        cout << "    " << a << " x ^ 2 + " << b << " x + " << c << " = 0" << endl;
        a1 = a;
        a = a / a1;
        b = b / a1;
        c = c / a1;
        cout << "<=> " << "x ^ 2 + " << b << " x + " << c << " = 0" << endl;
    }    
    else
    {
        cout << "    x ^ 2 + " << b << " x + " << c << " = 0" << endl;
    }    
    side = -c;
    cout << "<=> " << "x ^ 2 + " << b << " x = " << side << endl;
    b1 = b / 2;
    b2 = b1 * b1;
    side = side + b2;
    cout << "<=> " << "x ^ 2 + " << b << " x + " << b2 << " = " << side << endl;
    cout << "<=> " << "( x + " << b1 << " ) ^ 2 = " << side << endl;
    if (side < 0)
       cout << "L = { }";
    else
    side = sqrt(side);
    if (side != -side && side >= 0)
    {
    cout << "<=> " << "x + " << b1 << " = " << side << "   v   x + " << b1 << " = " << -side << endl;
    cout << "<=> " << "x = " << side-b1 << "   v   x = " << -side-b1;
    }
    else if (side == -side && side >= 0)
    {
        cout << "<=> " << "x + " << b1 << " = " << side << endl;
        cout << "<=> " << "x = " << side - b1 << endl;
    }
    else if (side < 0)
    ;
    cout << endl << endl << endl;
    getch();
} 
}
 
Hallo,
wieso machst du das nicht selber?

Also dein Programm benutzt ja keine special Features. Nur ein paar Ausgaben und ein
paar Berechnungen, die dir die Klasse Math der Java API zur Verfügung stellt.
Und die Methodensignatur der main Methode wirst du ja wohl noch selber hinbekommen...

Gruß

RedWing
 
Zurück