Español
Fuente/ Codesnippets

Abc2nr Buchstabenreihe Konvertieren Nr2abc Umwandeln Pagar Zählen - 3

 
Siehe auch: zaehlen cualquier buchstaben zaehler  [...] 

Jörg Sellmeyer (23.10.11)
Lo ha me no Ruhe gelassen y yo tener todavía weitergetüftelt. Jetzt tener ich's fuera y es letztlich unkomplizierter como anfangs esperado.
KompilierenMarcaSeparación
'y umgekehrt
'Jörg Selllmeyer 2011
'a freien Verwendung
'hier bekommt uno muy bien erklärt, como el Umrechnen de Pagar en un otro Base funktioniert:
'https://www.arndt-bruenner.de/mathe/scripts/Zahlensysteme.htm
'El Schwierigkeit hierbei, Es el fehlende Null. Alle Nullstellen necesario abgefangen voluntad, el
'aktuelle Punto en eins verringert y el folgende Punto ebenfalls en eins verringert voluntad.
'Der Valor A000 se entonces also sin Nullen a YYZ. C000 se a BYYZ

Proc Nr2ABC

    Parámetros Zahl!
    Declarar Valor$,Rest%

    Mientras que Zahl! > 0

        Rest% = Zahl! Mod 26
        Zahl! = Zahl! \ 26

        If Rest% = 0

            'hier voluntad el Nullstellen abgefangen y umgewandelt
            Zahl! = Zahl! -1
            Rest% = 26

        EndIf

        Case Rest% > 0:Valor$ = Chr$(Rest% + 64) + Valor$

    Wend

    Volver Valor$

ENDPROC

Proc ABC2Nr

    Parámetros Texto$
    Declarar Zahl!,Summe!,B$
    Texto$ = Upper$(Texto$)

    WhileLoop Len(Texto$),1,-1

        B$ = Substr$(Texto$,-&Loop)
        Zahl! = (Ord(B$)-64) * 26^(&Loop-1)
        Summe! = Summe! + Zahl!

    Wend

    Volver Int(Summe!)

ENDPROC

Cls
Título de la ventana "Zahlen en Buchstaben umwandeln y umgekehrt"
Imprimir "LQSVOFKGQM =", ABC2Nr("LQSVOFKGQM")
Imprimir "AAAAAA =", ABC2Nr("AAAAAA")
Imprimir "ABCDEFGH =", ABC2Nr("ABCDEFGH")
Imprimir
Imprimir "XPROFAN macht Spass =", ABC2Nr("XPROFAN"),ABC2Nr("macht"),ABC2Nr("Spass")
Imprimir
Declarar s$
Selección aleatoria

WhileLoop 10

    s$ = Chr$(Rnd(26) + 65) + s$

Wend

Imprimir s$ + " =",ABC2Nr(s$)
WaitInput
Cls
Selección aleatoria

WhileLoop 0,780,1

    Imprimir Nr2ABC(&Loop),

Wend

WaitInput
Cls

WhileLoop 00,480,1

    Imprimir Nr2ABC(&Loop + Rnd(345676)),

Wend

WaitInput

Hier es todavía una kleines Programa, en el uno una bischen herumexperimentieren kann:
KompilierenMarcaSeparación
 $H windows.ph
Def DelLast(2) Mid$(@$(1),1,(Len(@$(1)) - @&(2)))
'hier puede ser schön nachlesen, como así una Umrechnung funktioniert:
'https://www.arndt-bruenner.de/mathe/scripts/Zahlensysteme.htm

Proc Nr2ABC

    Parámetros Zahl!
    Declarar Valor$,Rest%

    Mientras que Zahl! > 0

        Rest% = Zahl! Mod 26
        Zahl! = Zahl! \ 26

        If Rest% = 0

            Zahl! = Zahl! -1
            Rest% = 26

        EndIf

        Case Rest% > 0:Valor$ = Chr$(Rest% + 64) + Valor$

    Wend

    Volver Valor$

ENDPROC

Proc ABC2Nr

    Parámetros Texto$
    Declarar Zahl!,Summe!,B$

    WhileLoop Len(Texto$),1,-1

        B$ = Substr$(Texto$,&Loop)
        Zahl! = Chr$(B$) * 26^(&Loop-1)
        Summe! = Summe! + Zahl!

    Wend

    Volver Summe!

ENDPROC

SubProc Crear.TextR

    Volver @Control("STATIC",@$(2),$50000002,@%(3),@%(4), \
    @%(5),@%(6),@%(1),101, %hInstance)

ENDPROC

Proc Text_setzen

    Parámetros cb&,txt&,txt1&
    Declarar Texto$,Ergebnis!
    Texto$ = GetText $(txt&)
    SetText txt1&,Str$((GetCurSel(cb&)) * Val(Texto$))
    Claro Texto$

    WhileLoop 0,Stellen%-1

        Ergebnis! = Val(GetText $(txt1&[&Loop])) + Ergebnis!
        Texto$ = Texto$ + GetText $(cb&[&Loop])

    Wend

    SetText txt_Ergebnis&,Str$(Ergebnis!)
    SetText txt_Alphabet&,Texto$
    SetText txt_Nr2ABC&,Nr2ABC(Ergebnis!)

ENDPROC

Proc Button_Aktion

    Parámetros btn&

    If GetText $(btn&) = "Null setzen"

        SendMessage(cb&[focus%],$014E,0,0)
        Text_setzen(cb&[focus%],txt&[focus%],txt1&[focus%])
        SetText btn&,"Zufall"

    Más

        SendMessage(cb&[focus%],$014E,Rnd(26),0)
        Text_setzen(cb&[focus%],txt&[focus%],txt1&[focus%])
        SetText btn&,"Null setzen"

    EndIf

ENDPROC

Proc Alle_Null

    Parámetros btn&

    If GetText $(btn&) = "alle Null setzen"

        WhileLoop 0,Stellen%-1

            SendMessage(cb&[&Loop],$014E,0,0)
            Text_setzen(cb&[&Loop],txt&[&Loop],txt1&[&Loop])
            SetText btn&[&Loop],"Zufall"

        Wend

        SetText btn&,"alle Zufall"

    Más

        WhileLoop 0,Stellen%-1

            SendMessage(cb&[&Loop],$014E,Rnd(26),0)
            Text_setzen(cb&[&Loop],txt&[&Loop],txt1&[&Loop])
            SetText btn&[&Loop],"Null setzen"

        Wend

        SetText btn&,"alle Null setzen"

    EndIf

ENDPROC

Declarar Stellen%
Stellen% = 10
Declarar cb&[Stellen%],txt&[Stellen%],txt1&[Stellen%],A$,x%,b%,focushdl&,focus%,Ergebnis&
Declarar btn&[Stellen% + 1]
b% = 118
x% = 120
Ventana de Estilo 8 | 24 | 512
Ventana Stellen% * (b% + 24),300
SetDialogFont ~GetStockObject($11)

WhileLoop 26

    a$ = a$ + Chr$(64 + &bucle) + "|"

Wend

a$ = " |" + DelLast(a$,1)
MoveStrToList(a$,"|")

WhileLoop 0,Stellen%-1

    cb&[&Loop] = Crear("ChoiceBox",%hwnd,0,5 + &Loop * x%,40,b%,160)
    Crear("Tooltip",%hwnd,cb&[&Loop],"26^" + Str$(Stellen%-1 - &Loop))
    MoveListToHandle(cb&[&Loop])
    SendMessage(cb&[&Loop],$014E,0,0)
    txt&[&Loop] = Crear("TextR",%hwnd,"",5 + &Loop * x%,10,b%,20)
    txt1&[&Loop] = Crear("TextR",%hwnd,"",5 + &Loop * x%,80,b%,20)
    btn&[&Loop] = Crear("Button",%hwnd,"Zufall",5 + &Loop * x%,110,b%,20)
    Case &Loop = Stellen% - 1:btn&[&Loop + 1] = Crear("Button",%hwnd,"Zufall",5 + (&Loop + 1) * x%,110,b%,20)

Wend

Var txt_Alphabet& = Crear("TextR",%hwnd,"",5 + Stellen% * x%,40,b% + Stellen%,20)
Var txt_Ergebnis& = Crear("TextR",%hwnd,"",5 + Stellen% * x%,80,b%,20)
Var txt_Nr2ABC& = Crear("TextR",%hwnd,"",5 + Stellen% * x%,140,b%,20)
Conjunto("Decimals",0)

WhileLoop 0,Stellen%-1

    SetText txt&[Stellen%-1 - &Loop],Str$(26^&Loop)

Wend

Selección aleatoria

Mientras que 1

    WaitInput
    focushdl& = %getfocus

    WhileLoop 0,Stellen%-1

        Case focushdl& = cb&[&Loop]:focus% = &Loop

        If focushdl& = btn&[&Loop]

            focus% = &Loop

        EndIf

    Wend

    If %key = 2

        Romper

    ElseIf GetFocus(cb&[focus%])

        Case GetCurSel(cb&[focus%]) > -1:Text_setzen(cb&[focus%],txt&[focus%],txt1&[focus%])

    ElseIf Clicked(btn&[focus%])

        Button_Aktion(btn&[focus%])

    ElseIf Clicked(btn&[Stellen%])

        Alle_Null(btn&[Stellen%])

    ElseIf %mousepressed = 2

        CreateMenu
        AppendMenu 100,"Summe kopieren"
        AppendMenu 101,"Buchstaben kopieren"
        TrackMenu %mousex,%mousey

        If MenuItem(100)

            ClearClip
            PutClip GetText $(txt_Ergebnis&)

        ElseIf MenuItem(101)

            ClearClip
            PutClip GetText $(txt_Alphabet&)

        EndIf

    EndIf

Wend


Hier es ni Auflistung:
KompilierenMarcaSeparación
Proc Nr2ABC

    Parámetros Zahl!
    Declarar Valor$,Rest%

    Mientras que Zahl! > 0

        Rest% = Zahl! Mod 26
        Zahl! = Zahl! \ 26

        If Rest% = 0

            Zahl! = Zahl! -1
            Rest% = 26

        EndIf

        Case Rest% > 0:Valor$ = Chr$(Rest% + 64) + Valor$

    Wend

    Volver Valor$

ENDPROC

Cls
ShowMax
Declarar Stellen%[6],Valor$[6],n%,a$,b$,OrdNr&,Encabezamiento$,s$
Claro Stellen%[]
OrdNr& = 1
Var b% = %maxx \ 27 -1

WhileLoop 26

    s$ = s$ + Chr$(64 + &bucle) + ";1;" + Str$(b%) + ";"

Wend

s$ = ";0;" + Str$(b%) + ";" + s$
Var l& = Crear("GridBox",%hwnd,s$,0,2,2,Width(%hwnd)-4,Height(%hwnd)-4)

WhileLoop 26^2

    WhileLoop 26

        B$ = B$ + Nr2ABC(OrdNr&) + "|"
        Inc OrdNr&

    Wend

    AddStrings(l&,Str$(OrdNr&-26) + "|" + b$)
    Claro b$
    Título de la ventana Str$(OrdNr&) + " Geduld - lo va a 26^3 (" + Str$(Int(26^3)) + ")"

Wend

Título de la ventana Str$(OrdNr&) + " Geduld - lo va a 26^3 (" + Str$(Int(26^3)) + ") fertig!"

Mientras que 1

    WaitInput

Wend


 
23.10.2011  
 



Zum Quelltext


Título del Tema, max. 100 Signo.
 

Systemprofile:

Kein Systemprofil creado. [anlegen]

XProfan:

 Contribución  Font  Smilies  ▼ 

Bitte registro en una Contribución a verfassen.
 

Tema opciones

7.086 Views

Untitledvor 0 min.
RudiB.18.09.2022
Michael W.30.03.2022
Thomas Zielinski02.12.2021
Uwe ''Pascal'' Niemeier24.11.2021
Más...

Themeninformationen

Dieses Thema ha 1 subscriber:

iF (1x)


Admins  |  AGB  |  Applications  |  Autores  |  Chat  |  Política de Privacidad  |  Descargar  |  Entrance  |  Ayuda  |  Merchantportal  |  Pie de imprenta  |  Mart  |  Interfaces  |  SDK  |  Services  |  Juegos  |  Búsqueda  |  Support

Ein Projekt aller XProfan, el lo son!


Mi XProfan
Privado Noticias
Eigenes Ablageforum
Temas-Merkliste
Eigene Beiträge
Eigene Temas
Zwischenablage
Cancelar
 Deutsch English Français Español Italia
Traducciones

Política de Privacidad


Wir uso Cookies sólo como Session-Cookies wegen el technischen Notwendigkeit y en uns hay no Cookies de Drittanbietern.

Wenn du hier en unsere Webseite klickst oder navigierst, stimmst du unserer Erfassung de Informationen en unseren Cookies en XProfan.Net a.

Weitere Informationen a unseren Cookies y dazu, como du el Kontrolle darüber behältst, findest du en unserer nachfolgenden Datenschutzerklärung.


einverstandenDatenschutzerklärung
Yo möchte no Cookie