English
Forum

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

 
- Page 1 -



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  
 



 
- Page 2 -


formel$ is just one String
declare formel$

the your code any characters among themselves writes is Yes program,
Print closes with \n ex -

remedy is behind The Print-Parameter one Semikolon or comma To write,

means print "10";
print "20";

gives 1020 from.

Wozu but print if it SetText in link z.B. with a create("text
or create("edit gives and drawText there too yet.

the your Taschenrechner not calculate properly is a Programmablaufproblem -
So one Logisches. there white I do not How I you help can because the Eindenken
into code - so How I it understood have - want You yourself give over.
so can I imho only write that the program imho very the power, as
program is.
 
01/26/13  
 




Gary12345
Yes OK have moreover learnt. Perhaps be so did i go ahead tired. but i'll everything give, it on my own the trouble To solve.

Thank you!
 
XProfan X2
MfG
Gary12345
01/26/13  
 



If you not further come then simply report.
 
01/26/13  
 




Gary12345
OK small Nebenfrage.

one can Zahlenwerte with st$ in string konventieren. How can I &werte in int transfiguring? goes the?
 
XProfan X2
MfG
Gary12345
01/26/13  
 



i see not, What is &werte ?

& is already int or. in 32-bit XProfan long or. is in 32-bit-XProfan int=long

there's val( circa from "20" 20 To make, quasi String->Float.
 
01/26/13  
 




Gary12345

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


Hi,

trouble1 resolved, it writes numbers next to each other, recognize tappt im dunkeln it not as 11 separate as 1 1 1 1 ... .
means was now a Teillösung.



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


Why to a string? I must still The first to a integer worth make? If Button with the inscription 1 pressed watts, füge worth 1 hinzu etc.

might someone its Gedankenschritte give, How to the solve could. Have now already with multiedits rumprobiert.

already proggt one what vermeintlich leichtes, the however then still something tougher is.

Nebenfrage:
CompileMarkSeparation
cls
var question$ = "Hallo, be I dumnm?"

Proc Message

    Parameters question$
    @Messagebox(question$,"hinweis",0)

ENDPROC

Message
WaitInput
End

Definition of Parameters:

The Aufrufparameter of/ one procedure go variables allocated, The inside the procedure famous are. One example finds itself under Proc. The Number of variables ought to not more than same the maximalen Number of Übergabeparameter sein; screen becomes this but just as little, as Datentypen. Gegebenenfalls results a automatic conversion.

either understand I Parameters wrong or in my code is what wrong.

If I Parameters entferne, becomes everything correctly displayed. what power now Parameters really?
CompileMarkSeparation
cls
FRAGE "Möchten tappt im dunkeln another further Messagebox see?"
WaitInput

Proc question

    Parameters fragetext$
    Messagebox(fragetext$,"F R A G E",4132)

    ifnot %Button=6

        end

    endif

    messagebox("Ich be really a nice Messagebox!","I n F O",4160)

ENDPROC


there goes it to that example.

there GetControlParas (B it the ""Möchten tappt im dunkeln another further Messagebox see?"" in a Parameter circa (fragetext$). means can somehow Parameter produce. understand But still not integrally.

LG
 
MfG
Gary12345
01/27/13  
 




Jörg
Sellmeyer
look you the at times
CompileMarkSeparation
Proc Problem

    Parameters Frage$,Loesung$

    If Frage$ = "Wie?"

        Loesung$ = "So!"

    ElseIf Frage$ = "Was?"

        Loesung$ = "Das!"

    EndIf

    Return Loesung$

EndProc

Cls
Print Problem("Wie?")
Print Problem("Was?")
WaitInput
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
01/27/13  
 




Gary12345
OK with the Parameters have I understood. is Yes integrally useful. only now counts it the others To clarify.
 
XProfan X2
MfG
Gary12345
01/27/13  
 




Gary12345
I have a theory, How I The others Problems solve could.

i'd z.B. the so make:
CompileMarkSeparation
Proc Summe()

    Parameters a!,b!
    var Ergebnis% = a1+b1

EndPr

(about)

gives it for mathematical Berechnungen a Includedatei, unless, would I possible so a building?
CompileMarkSeparation
Proc amount

    parameters a!,b!
    declare amount!
    set("decimals",2)
    amount! = a!+b!

ENDPROC

cls
var number! = amount(4.34,2.31)
print number!
WaitInput

the functions to that example.

an Include with you gefrunden: maths.inc , is bisschen verbuggt.

Beispielcode:
CompileMarkSeparation
 $I maths.inc

Proc amount

    parameters a!,b!
    declare amount!
    set("decimals",2)
    amount! = a!+b!

ENDPROC

cls
var number! = amount(3,2)
print number!
print pi!
WaitInput

the print pi! is from the INCLUDE. found have I it with you under INCLUDE. wait - I Search quick whom Link.

EDIT: here the Link: [...] 

with XProfan shining too a Standardinc included To his, The corresponds to but not my Ansprüchen. or. its over my Ansprüchen, I in the maths not mitkomme. Search yet to further Includes.

be in the meantime so far:
CompileMarkSeparation
Proc amount

    parameters a!,b!
    declare amount!
    set("decimals",2)
    amount! = a!+b!
    ROUND(amount!,2)
    return

ENDPROC

Proc less

    parameters a!,b!
    declare less!
    set("decimals",2)
    less! = a!-b!
    ROUND(less!,2)
    return

ENDPROC

Proc sharing

    parameters a!,b!
    declare sharing!
    set("decimals",2)
    sharing! = a!/b!
    ROUND(sharing!,2)
    return

ENDPROC

Proc Multiplizieren

    parameters a!,b!
    declare multiplizieren!
    set("decimals",2)
    multiplizieren! = a!*b!
    ROUND(Multiplizieren!,2)
    return

ENDPROC

Proc root

    parameters a!
    declare root!
    set("decimals",2)
    root! = sqrt(a!)
    Round(root!,2)
    return

ENDPROC

Proc Kreiszahl

    declare Pi!
    set("decimals",10)
    Pi! = 3.141592653589
    return

ENDPROC

Proc ADreieck

    parameters a!,b!
    declare ADreieck!
    set("decimals",2)
    ADreieck! = 0.5*a!*b!
    ROUND(ADreieck!,1)
    return

ENDPROC

cls
var number! = amount(3.433,2.434)
var number2! = less(3,2)
var number3! = sharing(3,2)
var number4! = Multiplizieren(3,2)
var number5! = ADreieck(3,2)
print number!
print number2!
print number3!
print number4!
print Kreiszahl()
print number5!
WaitInput

shining everything to go.
 
MfG
Gary12345
01/27/13  
 




Gary12345

CompileMarkSeparation
'Include programmiert von Gary12345

Proc Summe

    parameters a!,b!
    declare Summe!
    set("decimals",2)
    Summe! = a!+b!
    ROUND(Summe!,2)
    return

EndProc

Proc Minus

    parameters a!,b!
    declare Minus!
    set("decimals",2)
    Minus! = a!-b!
    ROUND(Minus!,2)
    return

EndProc

Proc Teilen

    parameters a!,b!
    declare Teilen!
    set("decimals",2)
    Teilen! = a!/b!
    ROUND(Teilen!,2)
    return

EndProc

Proc Multiplizieren

    parameters a!,b!
    declare multiplizieren!
    set("decimals",2)
    multiplizieren! = a!*b!
    ROUND(Multiplizieren!,2)
    return

EndProc

Proc Wurzel

    parameters a!
    declare Wurzel!
    set("decimals",2)
    Wurzel! = sqrt(a!)
    Round(Wurzel!,2)
    return

EndProc

Proc ADreieck

    parameters a!,b!
    declare ADreieck!
    set("decimals",2)
    ADreieck! = 0.5*a!*b!
    ROUND(ADreieck!,2)
    return

EndProc

Proc AQuadrat

    parameters a!
    declare Quadrat!
    set("decimals",2)
    Quadrat!=a!*a!
    ROUND(Quadrat!,2)
    return

EndProc

Proc ARechteck

    parameters a!,b!
    declare Rechteck!
    set("decimals",2)
    Rechteck! = a!*b!
    ROUND(Rechteck!,2)
    Return

EndProc

Proc AKreis

    parameters a!
    declare Kreis!
    set("decimals",2)
    Kreis! = @Pi()*a!
    ROUND(Kreis!,2)
    Return

EndProc

Proc ATrapez

    parameters a!,c!,h!'Trapezformel: 0.5*(a+c)*höhe! (h!)
    declare Trapez!
    set("decimals",2)
    Trapez! = 0.5*(a!+c!)*h!
    ROUND(Trapez!,2)
    Return

EndProc

Proc AParallelogramm

    parameters g!,h!
    declare Parallelogramm!
    set("decimals",2)
    Parallelogramm! = g!*h!'Grundfläche*Höhe
    ROUND(Parallelogramm!,2)
    Return

EndProc

Proc VWürfel

    Parameters a!
    declare Würfel!
    set("decimals",2)
    Würfel! = a!*a!*a!
    ROUND(Würfel!,2)
    Return

EndProc

Proc VQuader

    Parameters a!,b!,c!
    declare Quader!
    set("decimals",2)
    Quader! = a!*b!*c!
    ROUND(Quader!,2)
    Return

EndProc

Proc VKugel

    parameters r!
    declare Kugel!
    set("decimals",2)
    Kugel! = 4/3*@PI()*r!*r!*r!
    ROUND(Kugel!,2)
    Return

EndProc

Proc VKegel

    parameters r!,h!
    declare Kegel!
    set("decimals",2)
    Kegel! = 1/3*@PI()*r!*r!*h!
    ROUND(Kegel!,2pan>
    Return

ENDPROC


Zurzeitiger code. Include of my view ready.
 
MfG
Gary12345
01/27/13  
 



You must Yes The Digits not to a String add, but You could.

You can likewise with Click on a digit The actually amount with 10 Multiplizieren
and the worth the clicked digit add.

Virtually

0
klick 1
0*10+1
1
klick 5
1*10+5
15
klick 9
15*10+9
159

so lünden The Buttonklicks in worth.
 
01/27/13  
 




Gary12345
can I,may I my small Include with you present under the point INCLUDES?
 
XProfan X2
MfG
Gary12345
01/27/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.944 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