How to resolve the algorithm Show ASCII table step by step in the BASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Show ASCII table step by step in the BASIC programming language

Table of Contents

Problem Statement

Show  the ASCII character set  from values   32   to   127   (decimal)   in a table format.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Show ASCII table step by step in the BASIC programming language

Source code in the basic programming language

for i = 32 to 47
	for j = i to i + 80 step 16
		begin case
			case j = 32
				s$ = "Spc"
			case j = 127
				s$ = "Del"
			else
				s$ = chr(j)
		end case
		print rjust("  "+string(j),5); ": "; ljust(s$,3);
	next j
	print
next i

10 cls
20 for r = 0 to 15
30  for c = 1 to 6
40   a = 16+r+c*16
50   print right$("  "+str$(a),4)": " chr$(a)tab (10*c);
60  next c
70  print
80 next r


10 DEFINT I,J: DEFSTR S: DIM S(2)
20 S(0)="*  "
30 S(1)="Spc"
40 S(2)="Del"
50 FOR I=32 TO 47
60 FOR J=I TO 127 STEP 16
70 MID$(S(0),1,1) = CHR$(J)
80 PRINT USING "###: \ \ ";J;S(-(J=32)-2*(J=127));
90 NEXT J
100 PRINT
110 NEXT I

100 TEXT 80
110 FOR R=0 TO 15
120   FOR C=32+R TO 112+R STEP 16
130     PRINT USING "###":C;:PRINT ": ";CHR$(C),
140   NEXT
150   PRINT
160 NEXT

for i = 32 to 47
    for j = i to i + 80 step 16
        select case j
        case 32
            s$ = "Spc"
        case 127
            s$ = "Del"
        case else
            s$ = chr$(j)
        end select
        print right$("  "+str$(j),4); ": "; s$; space$(3);
    next j
    print
next i

FOR i = 32 TO 47
    FOR j = i TO i+80 STEP 16
        SELECT CASE j
        CASE 32
             LET s$ = "Spc"
        CASE 127
             LET s$ = "Del"
        CASE else
             LET s$ = CHR$(j)
        END SELECT
        PRINT USING "###: ###   ": j, s$;
    NEXT j
    PRINT
NEXT


PROGRAM  "ASCII table"
VERSION  "0.0000"

DECLARE FUNCTION Entry ()

FUNCTION  Entry ()
	FOR i = 32 TO 47
		FOR j = i TO i + 80 STEP 16
			SELECT CASE j
			CASE 32
				s$ = "Spc"
			CASE 127
				s$ = "Del"
			CASE ELSE
				s$ = CHR$(j)
			END SELECT
			PRINT RJUST$("  "+STRING(j),4); ": "; LJUST$(s$,3);
		NEXT j
		PRINT
	NEXT i
END FUNCTION
END PROGRAM


for i = 32 to 47
    for j = i to i + 80 step 16
	    s$ = chr$(j)
        if j = 32  s$ = "Spc"
        if j = 127 s$ = "Del"
		print str$(j, "#####"), ": ", s$;
    next j
    print
next i

  

You may also check:How to resolve the algorithm Determine if a string has all unique characters step by step in the Erlang programming language
You may also check:How to resolve the algorithm Mind boggling card trick step by step in the Lua programming language
You may also check:How to resolve the algorithm Elementary cellular automaton/Random number generator step by step in the Go programming language
You may also check:How to resolve the algorithm Successive prime differences step by step in the REXX programming language
You may also check:How to resolve the algorithm Deepcopy step by step in the PicoLisp programming language