Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Delphi
  4. F:=(50 div 3)

F:=(50 div 3)

Scheduled Pinned Locked Moved Delphi
questiondelphihelp
6 Posts 4 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    robertFFF
    wrote on last edited by
    #1

    hello i'am new in write programs in delphi. my problem is how can i get 16,66 in a variable? variable F:=(50 div 3) result must be 16,66 but integer is 16 sorry my english is not so good. thank you

    D R 2 Replies Last reply
    0
    • R robertFFF

      hello i'am new in write programs in delphi. my problem is how can i get 16,66 in a variable? variable F:=(50 div 3) result must be 16,66 but integer is 16 sorry my english is not so good. thank you

      D Offline
      D Offline
      dm1967
      wrote on last edited by
      #2

      try var f : double; .. f := (50 / 3)

      R 1 Reply Last reply
      0
      • D dm1967

        try var f : double; .. f := (50 / 3)

        R Offline
        R Offline
        robertFFF
        wrote on last edited by
        #3

        thank you but i forgot to write, the result must be in a label als Caption and this is a string. I get the error string and double not compatible. when i use integer then wiht the InToStr i get the Caption 16 and not 16,66 if you now how i hafe to do pleas thank you

        S 1 Reply Last reply
        0
        • R robertFFF

          thank you but i forgot to write, the result must be in a label als Caption and this is a string. I get the error string and double not compatible. when i use integer then wiht the InToStr i get the Caption 16 and not 16,66 if you now how i hafe to do pleas thank you

          S Offline
          S Offline
          smags13
          wrote on last edited by
          #4

          There is a function named FloatToStr which should fit your need.

          R 1 Reply Last reply
          0
          • S smags13

            There is a function named FloatToStr which should fit your need.

            R Offline
            R Offline
            robertFFF
            wrote on last edited by
            #5

            thank you smags13 its work.:thumbsup: :rolleyes:

            1 Reply Last reply
            0
            • R robertFFF

              hello i'am new in write programs in delphi. my problem is how can i get 16,66 in a variable? variable F:=(50 div 3) result must be 16,66 but integer is 16 sorry my english is not so good. thank you

              R Offline
              R Offline
              Roger Wright
              wrote on last edited by
              #6

              The operators div and mod are complimentary. Use div when you want the integer part of the division to be returned, and mod to get the remainder: 10 div 3 = 3 10 mod 3 = 1

              Will Rogers never met me.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups