English
Forum

Square root without Begrenzung

 
- Page 1 -



Stefan
Landsberg
Hi,

i want one Program write, that The Quadratwurzel a number accounts.
ABER it should not 6 Nachkommastellen rounds, separate as long as go on To one on Stop clicking.

question:
(How) can the curtail on 6 Nachkommastellen with sqrt() and pow() turn off.

If not goes, then must I me ever a procedure dreamup The that power.
but Please no Fertiglösung post. then learn I nothing.

another question:
is in XProfan 10 The length one floats terminable?
 
08/15/08  
 



 
- Page 1 -



Jac
de
Lad
No, No, No! Typischer Anfängerfehler. circa with the Inputs To calculate must You it first of String one Float transfiguring (see "Val()") and to spending in the MultiEdit again in a String (see "Str$()").
Declare
declare in&,out&,btn&,Result$,end%,input$
Window create
windowstyle 575
windowtitle "Quadratwurzel"
window 20,20 - 600,400
usefont "MS Sans Serif",20,0,0,0,0
Window style
in&=create("Edit",%hWnd,"25",5,5,580,20)
btn&=create("button",%hWnd,"Berechnen",250,30,100,30)
out&=create("multiedit",%hWnd,"",5,65,580,-270)

whilenot end%

    WaitInput
    case %key=2 : break

    if clicked(btn&)

        input$=gettext$(in&)
        Result$=Str $(sqrt(Val(input$)))
        settext out&,""
        settext out&,Result$

    endif

endwhile


Kürzer would your Prog so:
Declare
declare in&,out&,btn&,end%
Window create
windowstyle 575
windowtitle "Quadratwurzel"
window 20,20 - 600,400
usefont "MS Sans Serif",20,0,0,0,0
Window style
in&=create("Edit",%hWnd,"25",5,5,580,20)
btn&=create("button",%hWnd,"Berechnen",250,30,100,30)
out&=create("multiedit",%hWnd,"",5,65,580,-270)

whilenot end%

    WaitInput

    if %key=2

        break

    elseif clicked(btn&)

        settext out&,Str $(sqrt(Val(gettext$(in&))))

    endif

endwhile


to that Topic Berechnung:

You can either each place particular to charge let or a number quadrieren and depending on whether tappt im dunkeln To big or To small is always a little bit raise or take away. moreover must You the numbers in Strings Save and each place particular multiplizieren.

Jac
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
08/15/08  
 




Stefan
Landsberg
Hi,

I take for spending the ergebnisses one simple editfeld, but since I in my Program Yes on The available number always The recalculated place dranhängen wants, is it in my opinion unpraktisch and probably too too slow always first whom actually Text with gettext from the editfeld auszulesen, a new digit dranzuhängen, and then again The number with settext in that editfeld To write.
Gibts there a better method or irgendeine message (Gibts a Page/File in the The messages on german declared are) ?
 
08/19/08  
 



wm_copyData could you here help.
 
08/19/08  
 




Stefan
Landsberg
Hello,
thanks first but there somewhere ne Documentation in the The messages verständlich (best german) declared are?
I look with msdn not so correctly. through!
 
08/19/08  
 



clear, XProfan.com Search and google are The aide in such hardship!
 
08/19/08  
 




Stefan
Landsberg
after I jetz finally again little time for XProfan found Have (school claim ne whole crowd time. particularly latein )
place I time again a question:

Why we in the if request no worth on The variable firstpart$ transfer?
I Have already attempts tappt im dunkeln as integer To declarieren. goes neither:
Declare
declare in&,out&,calcbtn&,stopbtn&,Result$,end%,input$
PROC-part

Proc sqrtlong

    Algorithmus to that wander of/ one Quadratwurzel
    Parameters number$, output&, stopbtn&
    declare vorkomma$, div2%, firstsqrt%, firstpart$
    number$=translate $(number$, "," , ".") Dezimalkomma through Dezimalpunkt supplant
    vorkomma$=substr$(number$,1,".") Digits to the comma in vorkomma$ Save
    div2%=Instr(".",st$(substr$(len(vorkomma$ / 2),1,"."))) Verify whether The amount the Digits to the comma straight or ungerade is.

    if div2% = 0

        firstpart$=mid$(vorkomma$,0,2) first 2 Digits from vorkomma$ go in firstpart$ stored
        firstsqrt%=substr$(st$(sqrt(val(firstpart$))), 1 , ".") it becomes The sqrt from firstpart$ formed (remainder becomes omitted)

    else

        firstpart$=mid$(vorkomma$,0,1) first digit from vorkomma$ becomes in firstpart$ stored
        firstsqrt%=substr$(st$(sqrt(val(firstpart$))), 1 , ".") it becomes The sqrt from firstpart$ formed (remainder becomes omitted)

    endif

    locate 4,1 only to that testing what firstpart$ enhält
    print "firstpart:",firstpart$ only to that Test what firstpart$ enhält
    sendmessage(output&,$004A,%hWnd,Addr(firstsqrt%))

endproc

Window create
windowstyle 575
windowtitle "Quadratwurzel"
window 20,20 - 600,125
usefont "MS Sans Serif",20,0,0,0,0
Window style
in&=create("Edit",%hWnd,"25,5",5,5,580,20)
calcbtn&=create("button",%hWnd,"Berechnen",170,30,100,30)
stopbtn&=create("button",%hWnd,"Stop",310,30,100,30)
out&=create("Edit",%hWnd,"",5,65,580,20)

whilenot end%

    WaitInput
    case %key=2 : break

    if clicked(calcbtn&)

        sqrtlong gettext$(in&), out&, stopbtn&

    endif

endwhile

 
09/06/08  
 



The second Parameter of Mid$ must at least 1 his if one objectively ex first position detect would like.
 
09/06/08  
 




Stefan
Landsberg
ahhh,
thanks (Why be I there not self on it come )
 
09/06/08  
 



 
- Page 2 -



Stefan
Landsberg
soo,
I Have jetz another bisschen weitergebastelt, and it functions too everything so How I it wants.
but jetz Have I again my Completed: sendmessage.
what must I make, so the content the variable firstsqrt% on the editfeld out$ gesendet becomes?
CompileMarkSeparation
Declare
declare in&,out&,calcbtn&,stopbtn&,ergebnis$,ende%,eingabe$
PROC-Teil

Proc sqrtlong

    Algorithmus zum ziehen einer Quadratwurzel
    Parameters zahl$, output&, stopbtn&
    declare vorkomma$, div2$, firstsqrt%, firstpart$
    zahl$=translate$(zahl$, "," , ".") Dezimalkomma durch Dezimalpunkt ersetzen
    vorkomma$=substr$(zahl$,1,".") Ziffern vor dem Komma in vorkomma$ speichern
    div2$=substr$(len(vorkomma$)/2,2,".") Prüfen ob die Anzahl der Ziffern vor dem Komma gerade oder ungerade ist.
    locate 3,1
    print "div2:",div2$

    if div2$ = 0

        firstpart$=mid$(vorkomma$,1,2) erste 2 Ziffern aus vorkomma$ werden in firstpart$ gespeichert
        firstsqrt%=val(substr$(str$(sqrt(val(firstpart$))), 1 , ".")) es wird die sqrt aus firstpart$ gebildet (rest wird weggelassen)

    else

        firstpart$=mid$(vorkomma$,1,1) erste Ziffer aus vorkomma$ wird in firstpart$ gespeichert
        firstsqrt%=val(substr$(str$(sqrt(val(firstpart$))), 1 , "."))  es wird die sqrt aus firstpart$ gebildet (rest wird weggelassen)

    endif

    locate 4,1 nur zum testen was firstpart$ enhält
    print "firstpart:",firstpart$ nur zum test was firstpart$ enhält
    locate 5,1
    print "firstsqrt:",firstsqrt%
    sendmessage(output&,$004A,%hWnd,Addr(firstsqrt%))

endproc

Fenster erstellen
windowstyle 575
windowtitle "Quadratwurzel"
window 20,20 - 600,125
usefont "MS Sans Serif",20,0,0,0,0
Fenster gestalten
in&=create("edit",%hWnd,"25,5",5,5,580,20)
calcbtn&=create("button",%hWnd,"Berechnen",170,30,100,30)
stopbtn&=create("button",%hWnd,"Stop",310,30,100,30)
out&=create("edit",%hWnd,"",5,65,580,20)

whilenot ende%

    WaitInput
    case %key=2 : break

    if clicked(calcbtn&)

        sqrtlong gettext$(in&), out&, stopbtn&

    endif

endwhile

 
09/06/08  
 




CompileMarkSeparation
 
09/06/08  
 




Stefan
Landsberg
ok then mach ichs first so. but later would it from folgendem reason still effizienter another method To take or:

Stefan Löwen
Hi,

I take for spending the ergebnisses one simple editfeld, but since I in my Program Yes on The available number always The recalculated place dranhängen wants, is it in my opinion unpraktisch and probably too too slow always first whom actually Text with gettext from the editfeld auszulesen, a new digit dranzuhängen, and then again The number with settext in that editfeld To write.
Gibts there a better method or irgendeine message (Gibts a Page/File in the The messages on german declared are) ?


iF
wm_copyData could you here help.
 
09/06/08  
 



hang of it ex, whether You something on the Cursorposition "anhängen" want (wm_copyData), or whom whole Content supplant (setText).
 
09/06/08  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

10.424 Views

Untitledvor 0 min.
Sebastian Sprenger10/13/13
Andreas Koch12/20/11

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