Dies ist der gesamte, hatte
double Zahl1 = double.Parse(Xzahl.Text);
double Zahl2 = double.Parse(Yzahl.Text);
double Ergebnis;
vorhin vor dem if aber als die Quadrierung dazu kam musste wegen int ...
private void cmd_Click(object sender, EventArgs e)
{
if (AD.Checked)
{
double Zahl1 = double.Parse(Xzahl.Text);
double Zahl2 = double.Parse(Yzahl.Text);
double Ergebnis;
Ergebnis = Zahl1 + Zahl2;
lbl.Text = "Die Summe ist :" + Ergebnis.ToString ();
}
if (SB.Checked)
{
double Zahl1 = double.Parse(Xzahl.Text);
double Zahl2 = double.Parse(Yzahl.Text);
double Ergebnis;
Ergebnis = Zahl1 - Zahl2;
lbl.Text = "Die Differenz ist :" + Ergebnis.ToString ();
}
if (MP.Checked)
{
double Zahl1 = double.Parse(Xzahl.Text);
double Zahl2 = double.Parse(Yzahl.Text);
double Ergebnis;
Ergebnis = Zahl1 * Zahl2;
lbl.Text = "Das Produkt ist :" + Ergebnis.ToString();
}
if (DV.Checked)
{
double Zahl1 = double.Parse(Xzahl.Text);
double Zahl2 = double.Parse(Yzahl.Text);
double Ergebnis;
Ergebnis = Zahl1 / Zahl2;
lbl.Text = "Der Quotienten ist :" + Ergebnis.ToString();
}
if (HY.Checked)
{
double Zahl1 = double.Parse(Xzahl.Text);
int Zahl2 = int.Parse(Yzahl.Text);
double Ergebnis;
if (Zahl2 == 0)
{
lbl.Text = "Das Ergebniss ist : 1";
}
else
{
for (int i = 1; i < Zahl2; i++ )
{
Ergebnis = Ergebnis * Zahl1;
}
lbl.Text = "Das ergebnis ist : " + Ergebnis.ToString();
}