PROGRAM Nonsense_For_T_P_M_F;
                     {if program name is too long for double width printing}
                     {it is printed as emphasized and underlined}
Const
One=1;

Type
shortword=string[5];

FUNCTION Square(number: integer): integer;  {use caps for "function"}
                                   {begin/end counter starts now,}
                                {continues whenever there is a change}
Begin
  Square:=number*number;
End;
                                       {use caps for "procedure"}
PROCEDURE First(valueA: byte; valueB: integer; var varC:word);
var                     {"var" must be on a separate line, comments excepted}
varx,vary: integer;    {this should be italics if your printer supports this}
varz     : byte;

Begin
  varx:=One;
  vary:=valueA;
  varz:=valueB;
  varz:=Square(varz+1);
  varC:=varz;
End;

PROCEDURE Second(valueD: integer; valueE: shortword; var vrbleF: integer);

PROCEDURE Nested_Procedure(valueG: byte; var varAA: shortword);
Var                    {"Var" must be on a separate line, comments excepted}
vars  : byte;
varu  : shortword;

Begin
  varu:=Chr(valueD);
  vars:=length(varAA);

  If Pos(varu,varAA)=vars then
    begin
      varAA:=Copy(varAA,1,vars-1);
    end
End;

var
vrbleA             :   shortword;
vrbleB, wordlength :   byte;
JJ                 :   integer;

Begin
  Writeln('Enter a word up to four letters long.');
  Readln(vrbleA);
  wordlength:=length(vrbleA);
  Case wordlength of          {the key words "case, of" must be on same line}
  1,2,3,4:     Writeln('You entered a ',wordlength,' letter word.');
  Else         Writeln('You entered too long a word.');
  End;
  vrbleF:=0;
  For JJ:=1 to length(vrbleA) do
    begin
      vrbleB:=Ord( vrbleA[ JJ ] ) + vrbleF;
      Writeln('Enter ascii code for ',vrbleA[JJ],' letter of word.');
      Readln(JJ);
      If valueD=JJ then
        begin
          Write(#7);
          Writeln('Good!');
        end;
    end;
  Nested_Procedure(vrbleF div length(vrbleA), vrbleA);
                                      {index number on right side}
                                               {for procedure}
End;

VAR
            {use caps for global var declaration,also on a separate line}
GlobalA, GlobalB:  integer;
GlobalWord      :  word;
GlobalString    :  shortword;
GlobalC         :  byte;
                          {comment below is required, may be all caps}
BEGIN                                  {main program}
  First(GlobalC, GlobalA, GlobalWord);
  Second(GlobalB, GlobalString, GlobalA);
  GlobalC:=0;
                  {Procedures/functions emphasized and underlined,}
                     {indexing is done on right side of paper.}
                  {Global variables are double strike in main program.}

END.           {Table of procedures/functions will be printed after code.}
