How to resolve the algorithm Non-decimal radices/Input step by step in the HicEst programming language
How to resolve the algorithm Non-decimal radices/Input step by step in the HicEst programming language
Table of Contents
Problem Statement
It is common to have a string containing a number written in some format, with the most common ones being decimal, hexadecimal, octal and binary. Such strings are found in many places (user interfaces, configuration files, XML data, network protocols, etc.) This task requires parsing of such a string (which may be assumed to contain nothing else) using the language's built-in facilities if possible. Parsing of decimal strings is required, parsing of other formats is optional but should be shown (i.e., if the language can parse in base-19 then that should be illustrated). The solutions may assume that the base of the number in the string is known. In particular, if your language has a facility to guess the base of a number by looking at a prefix (e.g. "0x" for hexadecimal) or other distinguishing syntax as it parses it, please show that. The reverse operation is in task Non-decimal radices/Output For general number base conversion, see Non-decimal radices/Convert.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Non-decimal radices/Input step by step in the HicEst programming language
Source code in the hicest programming language
READ(Text="123459 ", Format="i10") dec ! 123459
READ(Text=" abcf123 ", Format="Z10") hex ! 180154659
READ(Text=" 7651 ", Format="o10") oct ! 4009
READ(Text=" 101011001", Format="B10.10") bin ! 345
You may also check:How to resolve the algorithm Y combinator step by step in the EchoLisp programming language
You may also check:How to resolve the algorithm Price fraction step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Text processing/1 step by step in the R programming language
You may also check:How to resolve the algorithm Variables step by step in the zkl programming language
You may also check:How to resolve the algorithm Topswops step by step in the Go programming language