Hier der Algorithmus den ich übersetzen will als Bild :

Code: Alles auswählen
; Coded By Sebastian Bienefeld (c)
Enumeration
#Window
EndEnumeration
Enumeration
#Text_0
#Text_1
#Text_2
#String_0
#String_1
#Button_0
#String_3
#Text_3
#Text_5
EndEnumeration
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Comic Sans MS", 12, #PB_Font_Bold)
Global FontID2
FontID2 = LoadFont(2, "Arial Black", 12)
Global FontID3
FontID3 = LoadFont(3, "Arial Black", 10)
Global FontID4
FontID4 = LoadFont(4, "Estrangelo Edessa", 10)
Global FontID5
FontID5 = LoadFont(5, "WST_Span", 10, #PB_Font_Bold)
Global FontID6
FontID6 = LoadFont(6, "Times New Roman", 10)
Global FontID7
FontID7 = LoadFont(7, "Times New Roman", 14)
Global FontID8
FontID8 = LoadFont(8, "Times New Roman", 12)
Procedure Berechne()
Zahl1$=GetGadgetText(4)
Zahl2$=GetGadgetText(5)
Zahl1.l = Val(Zahl1$)
Zahl2.l = Val(Zahl2$)
If Zahl1>Zahl2
Zahl1=zahl
Zahl2=test
Else
Zahl2=zahl
Zahl1=test
EndIf
If zahl % test = 0
Ergebnis_1=2
Ergebnis1=test
Ergebnis_1$=Str(Ergebnis1)
Else
Repeat
ergebnis_2=2
rest = zahl % test
zahl = test
test = rest
Ergebnis2=rest
Ergebnis_2$=Str(Ergebnis2)
Until rest=0
If Ergebnis_1=2
SetGadgetText(7, Ergebnis_1$)
Else
SetGadgetText(7, Ergebnis_2$)
EndIf
EndIf
Debug Ergebnis_2$
EndProcedure
If OpenWindow(#Window, 241, 42, 510, 150, "Der euklidische Algorithmus", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar ) And CreateGadgetList(WindowID(#Window))
TextGadget(1, 20, 20, 500, 40, "Der euklidische Algorithmus berechnet den ggT von zwei Zahlen:")
SetGadgetFont(1, FontID7)
TextGadget(2, 10, 70, 60, 30, "Zahl 1:")
SetGadgetFont(2, FontID8)
TextGadget(3, 10, 100, 60, 30, "Zahl 2:")
SetGadgetFont(3, FontID8)
StringGadget(4, 90, 70, 140, 20, "", #PB_String_Numeric) ;Zahl 1
StringGadget(5, 90, 100, 140, 20, "", #PB_String_Numeric) ;Zahl 2
ButtonGadget(6, 250, 60, 80, 60, "Berechne") ; Berechne
StringGadget(7, 360, 100, 120, 20, "", #PB_String_ReadOnly) ; Ergebnis
TextGadget(8, 360, 70, 120, 20, "Ergebnis:", #PB_Text_Center)
SetGadgetFont(8, FontID8)
TextGadget(9, 10, 130, 200, 20, "Made by Sebastian Bienefeld (c)")
EndIf
Repeat
Event= WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
quit=1
Case #PB_Event_Gadget
Select EventGadget()
Case 6
EndSelect
EndSelect
Until quit=1
gruß DarkSkillu