How to resolve the algorithm Character codes step by step in the Icon and Unicon programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Character codes step by step in the Icon and Unicon programming language
Table of Contents
Problem Statement
Given a character value in your language, print its code (could be ASCII code, Unicode code, or whatever your language uses).
The character 'a' (lowercase letter A) has a code of 97 in ASCII (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out the corresponding character.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Character codes step by step in the Icon and Unicon programming language
Source code in the icon programming language
procedure main(arglist)
if *arglist > 0 then L := arglist else L := [97, "a"]
every x := !L do
write(x, " ==> ", char(integer(x)) | ord(x) ) # char produces a character, ord produces a number
end
You may also check:How to resolve the algorithm CSV to HTML translation step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Calculating the value of e step by step in the Phixmonti programming language
You may also check:How to resolve the algorithm Least common multiple step by step in the UNIX Shell programming language
You may also check:How to resolve the algorithm Old lady swallowed a fly step by step in the Elixir programming language
You may also check:How to resolve the algorithm Strip block comments step by step in the Seed7 programming language