Lazarus: Enter Binary Numbers using Zeros and Ones directly in the Code
Question by Guest | 2014-02-02 at 21:33
Currently, I am writing a program in which I need to perform some calculations. Because of the numbers and values used, the easiest way for me would be to enter the values not as an integer but directly as a binary number.
So, I would like to enter the 1s and 0s such as the computer is calculating internally directly in my code (for example "101001" + "100010").
Is there any way to do that? Some of my recent attempts were not crowned with any success, I only got compiler errors.
Related Topics
Lazarus: Input of binary, hexadecimal and integer numbers
Article | 0 Comments
XAMPP: How to set up SSL/HTTPS for local Projects
Tutorial | 0 Comments
Delphi/Lazarus: Only allow Numbers in TEdit
Tip | 0 Comments
JavaScript: Remove leading zeros
Tip | 2 Comments
How to Replace multiple Texts at the same Time
Tutorial | 0 Comments
Lazarus: Load File as Byte Array and save Byte Array as File
Tutorial | 0 Comments
Delphi/Lazarus: Display current Date and Time
Tip | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
Yes. This is possible without any problems. Numbers that are given in binary format are marked with a preceding %:
So, instead of the decimal number 10, you can also write %1010 and combine those binary values with integers. In the example above, we add the integer value 10 to the binary number 1010 and obtain 20 as a result.
For more information, check out the article about the input of binary numbers, hexadecimal numbers and integers in Lazarus, I have just written after you have brought me with your question to that idea.
2014-02-03 at 16:46