#pragma endregion bool primzahl(long long zahl) { bool prim = true; long long i; double Wurzel; Wurzel = Math::Sqrt(zahl); for(i=2; i<=Wurzel; i++) if(zahl%i==0) { prim=false; break; } return prim; } private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { textBox1->Text=""; textBox1->Focus(); textBox2->Text=""; } private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { long long zahl, diff; try { textBox2->Text=""; zahl=Convert::ToInt64(textBox1->Text); if((zahl>5) && (zahl%2 == 0)) { for(long long i=3; i<=zahl/2; i+=2) if (primzahl(i)) { diff = zahl - i; if(primzahl(diff)) textBox2->Text += i + " + " + diff + "\x0d\x0a"; } } else textBox2->Text="Ungültige Zahl!"; } catch(FormatException^ Fehler) { textBox2->Text="Bitte nur eine Zahl eingeben!"; } catch(OverflowException^ Fehler) { textBox2->Text="Die Zahl ist zu groß!"; } catch(Exception^ Fehler) { MessageBox::Show(Fehler->Message); } } private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { } }; }