Category : Files from Magazines
Archive   : VOL8N17.ZIP
Filename : ALPHACOL.PAS

 
Output of file : ALPHACOL.PAS contained in archive : VOL8N17.ZIP



PROGRAM AlphaCol;
(*Translate integers to and from alphabetic
column headings. Integers from 0 to 701,
headings from " A" to "ZZ"*)

TYPE AString = STRING[2];

VAR i : Integer;

FUNCTION Alpha(i : Integer) : AString;
CONST digits : ARRAY[0..26] OF Char = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ';
BEGIN
Alpha := digits[i DIV 26] + digits[Succ(i MOD 26)];
END;

FUNCTION Numeric(AlStg : AString) : Integer;
BEGIN
IF AlStg[1] = ' ' THEN
Numeric := (Ord(AlStg[2])-65)
ELSE
Numeric := ((Ord(AlStg[1])-64)*26) + (Ord(AlStg[2])-65);
END;

BEGIN {Demo}
FOR i := 0 TO 701 DO
BEGIN
Write('Column is *', Alpha(i), '*');
WriteLn(' Column value is ', Numeric(Alpha(i)), '.');
END;
END.





  3 Responses to “Category : Files from Magazines
Archive   : VOL8N17.ZIP
Filename : ALPHACOL.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/