ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Covert from Python to Pascal

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Srecko Posted - Sep 10 2021 : 13:59:17
Hello i would need to covert this py program to pascal but im not very familiar with pascal. Can someone help me?


x = int(input("Unestite broj: "))
if not x == 0:
    y = int(input("Unesite jos jedan broj: "))
    if y == 0:
        if x % 10 == 7:
            nulti = x
            print (x)
    else:
        z = int(input("Unesite jos jedan broj: "))
        if z == 0:
            if y % 10 == 7 and x % 10 == 7:
                prvi = (x+y)/2
                print (prvi)
            if y % 10 == 7 and not x % 10 == 7:
                prvia = y
                print (prvia)
            if x % 10 == 7 and not y % 10 == 7:
                prvib = x
                print (prvib)
        else:
            a = int(input("Unesite jos jedan broj: "))
            if a == 0:
                if z % 10 == 7 and y % 10 == 7 and x % 10 == 7:
                    prvi = (x+y+z)/3
                    print (prvi)
                if z % 10 == 7 and not x % 10 == 7 and not y % 10 == 7:
                    prvia = z
                    print (prvia)
                if z % 10 == 7 and x % 10 == 7 and not y % 10 == 7:
                    prvid = (z+x)/2
                    print (prvid)


                if y % 10 == 7 and not x % 10 == 7 and not z % 10 == 7:
                    prvig = y
                    print (prvig)
                if y % 10 == 7 and z % 10 == 7 and not x % 10 == 7:
                    prvik = (y+z)/2
                    print (prvik)


                if x % 10 == 7 and not y % 10 == 7 and not z % 10 == 7:
                    prvib = x
                    print (prvib)
                if x % 10 == 7 and y % 10 == 7 and not z % 10 == 7:
                    prvic = (x+y)/2
                    print (prvic)
            else:
                b = int(input("Unesite jos jedan broj: "))
                if b == 0:
                    if z % 10 == 7 and y % 10 == 7 and x % 10 == 7 and not a % 10 == 7:
                        prvi = (x+y+z)/3
                        print (prvi)
                    if z % 10 == 7 and not x % 10 == 7 and not y % 10 == 7 and not a % 10 == 7:
                        prvia = z
                        print (prvia)
                    if z % 10 == 7 and x % 10 == 7 and not y % 10 == 7 and not a % 10 == 7:
                        prvib = (z+x)/2
                        print (prvib)


                    if y % 10 == 7 and not x % 10 == 7 and not z % 10 == 7 and not a % 10 == 7:
                        prvic = y
                        print (prvic)
                    if y % 10 == 7 and z % 10 == 7 and not x % 10 == 7 and not a % 10 == 7:
                        prvid = (y+z)/2
                        print (prvid)


                    if x % 10 == 7 and not y % 10 == 7 and not z % 10 == 7 and not a % 10 == 7:
                        prvie = x
                        print (prvie)
                    if x % 10 == 7 and y % 10 == 7 and not z % 10 == 7 and not a % 10 == 7:
                        prvif = (x+y)/2
                        print (prvif)

                    if z % 10 == 7 and y % 10 == 7 and x % 10 == 7 and a % 10 == 7:
                        prvig = (x+y+z+a)/4
                        print (prvig)
                    if a % 10 == 7 and z % 10 == 7 and y % 10 == 7 and not x % 10 == 7:
                        prvij = (a+z+y)/3
                        print (prvij)
                    if a % 10 == 7 and z % 10 == 7 and x % 10 == 7 and not y % 10 == 7:
                        prvik = (a+z+x)/3
                        print (prvik)
                    if a % 10 == 7 and y % 10 == 7 and x % 10 == 7 and not z % 10 == 7:
                        prvil = (a+y+x)/3
                        print (prvil)                        
                    if a % 10 == 7 and y % 10 == 7 and not x % 10 == 7 and not z % 10 == 7:
                        prvim = (a+y)/2
                        print (prvim)      
                    if a % 10 == 7 and z % 10 == 7 and not x % 10 == 7 and not y % 10 == 7:
                        prvin = (a+z)/2
                        print (prvin)
                    if a % 10 == 7 and x % 10 == 7 and not y % 10 == 7 and not z % 10 == 7:
                        prvio = (a+x)/2
                        print (prvio)
                    if a % 10 == 7 and not x % 10 == 7 and not y % 10 == 7 and not z % 10 == 7:
                        prvip = a
                        print (a)
    

else:
    quit()

1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 10 2021 : 17:38:37
Hi

Find and Replace will fix most of this for you:

Replace = with :=
Replace :=:= (was ==) with =
Replace % with mod
Replace " with '
Replace Int( with StrToInt(
Replace Quit with Exit

Then:
Convert : blocks to begin/end blocks
Add semicolon to end of all lines
Replace Input with InputQuery() or InputDlg(). You'll need some parameters for that.


Nigel
Xequte Software
www.imageen.com