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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Covert from Python to Pascal
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Srecko

Bosnia and Herzegovina
1 Posts

Posted - Sep 10 2021 :  13:59:17  Show Profile  Reply
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()

xequte

38182 Posts

Posted - Sep 10 2021 :  17:38:37  Show Profile  Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: