Find '?' and 'fish', prog for newcomers

Although this program is in response to two specific requests,
it also contains some simple examples related to other Pascal
new comer questions asked in this news group.

<clifp...@airmail.net>    12:00PM  11/19/95

--------------------Program below---------------------

Program Query_and_Search;
{ Clif Penn    11/19/1995   Written in Turbo v 6.0
  Response to two beginners requests, one on recognizing a string
  terminating '?' and the other on string searching and
  substitution. }

Uses CRT;
Label cont;

CONST
Query = 'How do you tell a question from a statement?' ;
Statement = 'Pascal contains string manipulation functions.';
Fish = 'I think I caught a fish!';

VAR
Svar : String;
n : Integer;

PROCEDURE DetectQ (s:string);
CONST
     Q = 'That is a question.' ;
     NoQ = 'That is not a question.';
VAR
   LastCh : String[1];   { TYPE Char will not work! }

BEGIN
     LastCh := Copy(s, Length(s), 1);
     If LastCh = '?' Then WriteLn(Q)
     Else  WriteLn(NoQ);
     WriteLn;
END;

BEGIN { main program}
     ClrScr;
     Svar := Query;
     WriteLn(Svar);
     DetectQ(Svar);

     Svar := Statement;
     WriteLn(Svar);
     DetectQ(Svar);

     WriteLn('<Enter> your own string. <Enter> nothing to quit.');
     WriteLn;
     REPEAT
           Write('Str := ');
           ReadLn(Svar);
           If Svar = '' Then Goto cont;
           DetectQ(Svar);
cont:
     UNTIL Svar = '' ;

     WriteLn;
     Svar := Fish;
     WriteLn('Original = ', Svar);
     n := Pos('fish', Svar);  {position of first char of 'fish'}
     Delete (Svar, n, 4);     {deletes 'fish', leaves '!'}
     Insert('whale', Svar, n);
     WriteLn('Modified = ', Svar);

     WriteLn;
     Write('Press <Enter> ');
     Readln; { dummy }
END.