How to resolve the algorithm Idiomatically determine all the lowercase and uppercase letters step by step in the FreeBASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Idiomatically determine all the lowercase and uppercase letters step by step in the FreeBASIC programming language
Table of Contents
Problem Statement
Idiomatically determine all the lowercase and uppercase letters (of the Latin [English] alphabet) being used currently by a computer programming language. The method should find the letters regardless of the hardware architecture that is being used (ASCII, EBCDIC, or other).
Display the set of all: that can be used (allowed) by the computer program, where letter is a member of the Latin (English) alphabet: a ──► z and A ──► Z.
You may want to mention what hardware architecture is being used, and if applicable, the operating system.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Idiomatically determine all the lowercase and uppercase letters step by step in the FreeBASIC programming language
Source code in the freebasic programming language
enum chartypes
LOWER = -1, UPPER = 1, NOTLETTER = 0
end enum
function letter_case( ch as string ) as byte
'exploits the fact that ucase and lcase consider non-letters to be
'both upper and lower case
if ucase(ch)=lcase(ch) then return NOTLETTER
if ch = ucase(ch) then return UPPER
return LOWER
end function
dim as uinteger i
for i = 0 to 255
if letter_case(chr(i)) = LOWER then print chr(i);
next i
print
for i = 0 to 255
if letter_case(chr(i)) = UPPER then print chr(i);
next i
print
You may also check:How to resolve the algorithm Almost prime step by step in the Phixmonti programming language
You may also check:How to resolve the algorithm Find the missing permutation step by step in the C# programming language
You may also check:How to resolve the algorithm First-class functions/Use numbers analogously step by step in the JavaScript programming language
You may also check:How to resolve the algorithm File input/output step by step in the C programming language
You may also check:How to resolve the algorithm Word wrap step by step in the J programming language