English
Forum

at that Taschenrechner program! Kapier there what not. or. can Error not understand

 

Gary12345
Hi,
CompileMarkSeparation
Window 0,0-400,400

Proc Hauptprogramm

    declare wert%, wert2%, wert3%, wert4%, wert5%, wert6%, wert7%, wert8%, wert9%, wert10%
    var Button1& = CREATE("Button",%HWND,"1", 50, 50, 50, 50)
    var Button2& = CREATE("Button",%HWND,"2",50, 100, 50, 50)
    var Button3& = CREATE("Button",%HWND,"3",50,150,50,50)
    var Button4& = CREATE("Button",%HWND,"4",50,200,50,50)
    var Button5& = CREATE("Button",%HWND,"5",50,250,50,50)
    var Button6& = CREATE("Button",%HWND,"6",100,50,50,50)
    var Button7& = CREATE("Button",%HWND,"7",100,100,50,50)
    var Button8& = CREATE("Button",%HWND,"8",100,150,50,50)
    var Button9& = CREATE("Button",%HWND,"9",100,200,50,50)
    var Button10& = CREATE("Button",%HWND,"0",100,250,50,50)
    var Button11& = CREATE("Button",%HWND,"+",200,50,50,50)
    var Button12& = CREATE("Button",%HWND,"-",200,100,50,50)
    var Button13& = CREATE("Button",%HWND,":",200,150,50,50)
    var Button14& = CREATE("Button",%HWND,"*",200,200,50,50)
    var Button15& = CREATE("Button",%HWND,"=>",200,250,50,50)
    var ButtonClear& = CREATE("Button", %HWND, "TEST100", 250,100,100,100)

    While 1

        WaitInput

        If clicked(Button1&)

            wert% = 1
            Print wert%

        EndIf

        If clicked(Button2&)

            wert2% = 2
            print wert2%

        EndIf

        If clicked(Button3&)

            wert3% = 3
            print wert3%

        EndIf

        If clicked(Button4&)

            wert4% = 4
            print wert4%

        EndIf

        If clicked(Button5&)

            wert5% = 5
            print wert5%

        EndIf

        If clicked(Button6&)

            wert6% = 6
            print wert6%

        EndIf

        If clicked(Button7&)

            wert7% = 7
            print wert7%

        EndIf

        If clicked(Button8&)

            wert8% = 8
            print wert8%

        EndIf

        If clicked(Button9&)

            wert9% = 9
            print wert9%

        EndIf

        If clicked(Button10&)

            wert10% = 0
            print wert10%

        EndIf

        If clicked(Button11&)

            var Ergebnis$[wert1%,wert2%,wert3%,wert4%,wert5%,wert6%,wert7%,wert8%,wert9%,wert10%] = wert%+wert2%+wert3%+wert4%+wert5%+wert6%+wert7%+wert8%+wert9%+wert10%
            print Ergebnis$

        EndIf

        If clicked(ButtonClear&)

            cls

        EndIf

    EndWhile

EndProc

While 1

    WaitInput
    Hauptprogramm

EndWhile


How I vorgegangen be:

1. have consider, whether I Buttons use should or only one Edit box. I have me for schwierigere Variante decided, namely The Buttons.
2. the Hauptprogramm in a procedure set. Externe functions go in a Extra-Proc treats.
3. any Buttons a worth allocate (naturally integer) => worth% - worth10%
4. if Button "+" pressed watts, any values add. To guter letzt tappt im dunkeln with print present let (the Result naturally)

my trouble:

1. it add everything correctly., only if I the second time add have (So the second time rechne without ClearUp) comes a Error Message, I The Variable Result twice declared have. can this Error not understand.
2. If I only once two values add and then To guter Letzt on the Button100 click, comes at second calculate too a Error Message. this is against The same How in trouble1 described.
3. I can only values 0-9 present. No values over 9. Why? Why depends it always a number drunter instead of next to the number? can I neither understand.

How your me help could

i will none Lösungscode. i will only Notes on The cause this Fehlers. what I very wrong made have and yet further others things. moreover would I the trouble not everything at a single blow make, separate everything step for step. i was it former dwelt just Codes To get, but this time I will really learn. If I what not understand, then frag I even to. but Notes instead of the whole Solution is often sinnvoller as one think.

therefore many Thanks already in advance!
 
XProfan X2
MfG
Gary12345
01/26/13  
 




Dieter
Zornow
In of/ one Loop ought to one no Variable declarieren, therefore comes the.

but there are yet More Error drin, at that Start have I one leeres Window, first if I click attend The Buttons but a row missing integrally. I have me whom code not further viewing only to the variables sought, I whom suspicion having, that The in the Loop declariert becomes.
 
XProfan X2
Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2
01/26/13  
 




Gary12345
super trouble1 and trouble2 are resolved.

means new Problem

trouble4:

If to the launch, is first one leeres Window there.

will be there time rumschauen, what there go is.
 
XProfan X2
MfG
Gary12345
01/26/13  
 




Gary12345
I mach here time a Problemsammlung:

trouble1:
If one 1+1 rechnet comes always only yet 1 out, because I only any values add have, but not berücksichtigt have, the one too number of times same values prompt can.
z.B. 1+1+1=1
2+2+2=2
3+3+3=3
trouble2:
If one two different numbers together add and the Result with the equal number add, remaining the Result same.
z.B. 2+7=9+7=9
3+6=9+6=9
with the Button Test100 does it but then again.
trouble3:
one can no 11 prompt. because it writes the numbers always among themselves and not next to each other.

I suspect, that trouble1 and trouble2 from mathematischen Found not voices. therefore attempt I the yourself To solve. I pieces you with, if I not create. I geb you whom actually code. If still what on the code wrong is, divides your it still Please me with
CompileMarkSeparation
Window 0,0-400,400
declare wert%, wert2%, wert3%, wert4%, wert5%, wert6%, wert7%, wert8%, wert9%, wert10%
declare Ergebnis$
declare button1&, button2&, button3&, button4&, button5&, button6&, button7&, button8&, button9&, button10&, button11&, button12&, button13&, button14&
declare button15&, buttonclear&

Proc Hauptprogramm

    Button1& = CREATE("Button",%HWND,"1", 50, 50, 50, 50)
    Button2& = CREATE("Button",%HWND,"2",50, 100, 50, 50)
    Button3& = CREATE("Button",%HWND,"3",50,150,50,50)
    Button4& = CREATE("Button",%HWND,"4",50,200,50,50)
    Button5& = CREATE("Button",%HWND,"5",50,250,50,50)
    Button6& = CREATE("Button",%HWND,"6",100,50,50,50)
    Button7& = CREATE("Button",%HWND,"7",100,100,50,50)
    Button8& = CREATE("Button",%HWND,"8",100,150,50,50)
    Button9& = CREATE("Button",%HWND,"9",100,200,50,50)
    Button10& = CREATE("Button",%HWND,"0",100,250,50,50)
    Button11& = CREATE("Button",%HWND,"+",200,50,50,50)
    Button12& = CREATE("Button",%HWND,"-",200,100,50,50)
    Button13& = CREATE("Button",%HWND,":",200,150,50,50)
    Button14& = CREATE("Button",%HWND,"*",200,200,50,50)
    Button15& = CREATE("Button",%HWND,"=>",200,250,50,50)
    ButtonClear& = CREATE("Button", %HWND, "TEST100", 250,100,100,100)

EndProc

Hauptprogramm

While 1

    WaitInput

    If clicked(Button1&)

        wert% = 1
        Print wert%

    EndIf

    If clicked(Button2&)

        wert2% = 2
        print wert2%

    EndIf

    If clicked(Button3&)

        wert3% = 3
        print wert3%

    EndIf

    If clicked(Button4&)

        wert4% = 4
        print wert4%

    EndIf

    If clicked(Button5&)

        wert5% = 5
        print wert5%

    EndIf

    If clicked(Button6&)

        wert6% = 6
        print wert6%

    EndIf

    If clicked(Button7&)

        wert7% = 7
        print wert7%

    EndIf

    If clicked(Button8&)

        wert8% = 8
        print wert8%

    EndIf

    If clicked(Button9&)

        wert9% = 9
        print wert9%

    EndIf

    If clicked(Button10&)

        wert10% = 0
        print wert10%

    EndIf

    If clicked(Button11&)

        Ergebnis$ = str$(wert%+wert2%+wert3%+wert4%+wert5%+wert6%+wert7%+wert8%+wert9%+wert10%)
        print Ergebnis$

    EndIf

    If clicked(ButtonClear&)

        cls

    EndIf

EndWhile

 
MfG
Gary12345
01/26/13  
 




Gary12345
come simply not on it.

I should The Variable worth% vervielfachen, the too others numbers except only 1,2,3,4,5,6,7,8,9 rauskommen.

one should inquire, whether The Buttons multiple pressed been are, or not?

can someone only TIPPS give, Please no Solutions. (means To trouble1)

thanks
 
MfG
Gary12345
01/26/13  
 



there's many Approaches a einfachen Taschenrechner umzusetzen.
there You yourself in reference on The Ressourcen Your computers quasi in the
Cockaigne befindest, can You it you very slight make.

Mach still first, that if one a Button clicking, that the suitable
characters to a String added becomes.

Virtually pressure on 5: formel$=formel$+"5"
Virtually pressure on +: formel$=formel$+"+"
Virtually pressure on 9: formel$=formel$+"9"

at that Istgleichzeichen must then only yet formel$ just go,
for there The function eval( ... ( [...]  ).

alas Yes, eval Gibts Yes not yet -

then simply: [...] 
 
01/26/13  
 




Gary12345
i'm sincere:

from the code there kapier I reingarnichts and I will neither utilize. gives it a others Possibility the To solve. About input wärs Yes plenty leichter. there should to the input only in a string pack and the then adieren. the schaut but not so beautiful from.
 
XProfan X2
MfG
Gary12345
01/26/13  
 



How written there Yes many Lösungswege. have You another idea?
 
01/26/13  
 




Gary12345
I kenn two Lösungswege:

1. Per Edit box To make (Input,editfeld,etc.)
2. or by Buttons...

which there yet?
 
XProfan X2
MfG
Gary12345
01/26/13  
 



your Lösungswegen can I not so correctly. entnehmen what very tappt im dunkeln
everything solve should.

the a is the display/ surface quasi UI -
the others is the calculate.

my hint was Yes:

Mach still first, that if one a Button clicking, that the suitable
characters to a String added becomes.

Virtually pressure on 5: formel$=formel$+"5"
Virtually pressure on +: formel$=formel$+"+"
Virtually pressure on 9: formel$=formel$+"9"


additionally can:

1. Per Edit box To make (Input,editfeld,etc.)
2. or by Buttons...

too join so one with the Buttons "nur" one Edit befüllt one but the
Edit too directly edit can.
 
01/26/13  
 




Gary12345
Vll can I you it now something explain:

If you my code in XPROFAN eingibst and ausführst, merkst You , that it any numbers among themselves writes and not next to each other. the others trouble was, that if I 1+1=1 yields, there the code not two same values add can. the latest trouble is, that whom I 6+2=8+2=8 yields, and there have I none plan Why.

first would I the first trouble solve.



Mach still first, that if one a Button clicking, that the suitable
characters to a String added becomes.

Virtually pressure on 5: formel$=formel$+"5"
Virtually pressure on +: formel$=formel$+"+"
Virtually pressure on 9: formel$=formel$+"9"


i don't know, I under formel$ understand should.
 
XProfan X2
MfG
Gary12345
01/26/13  
 




Gary12345


additionally can:

1. Per Edit box To make (Input,editfeld,etc.)
2. or by Buttons...

too join so one with the Buttons "nur" one Edit befüllt one but the
Edit too directly edit can.


the would too a very optionale Solution. but answer still Please on the oberen mail
 
XProfan X2
MfG
Gary12345
01/26/13  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

24.290 Views

Untitledvor 0 min.
ecki12/29/23
MrZebulon08/05/18
rawerra12/30/16
Peter Max Müller10/30/14
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie