home *** CD-ROM | disk | FTP | other *** search
- Program LowCase(Input, Output);
-
- (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
- (* This program will change all upper case alphabetic characters to *)
- (* its lower case equivilant. *)
- (* *)
- (* Input for this program is a sequential disk file. Output can be *)
- (* to the monitor screen, the printer, or a disk file. *)
- (* *)
- (* You will need to get BOX.PAS for this to run, use it as an include *)
- (* file. *)
- (* Written by Bill Cote - 71256,402 *)
- (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
-
- Type
- String12 = String[12];
- String255 = String[80];
-
- Var
- Screen,
- Printer,
- Disk : Boolean;
- Answer : Char;
- FileName : String12;
- LowCaseRec : String255;
- InputRec,
- OutputRec : Text;
-
- Procedure SetScreen;
- Begin
- TextMode(C80);
- TextColor(White);
- TextBackGround(Blue);
- GraphBackGround(Blue);
- ClrScr
- End;
-
- Procedure ChangeCase;
- Var
- I,
- X : Integer;
-
- Begin
- For I := 1 To Length(LowCaseRec) Do
- Begin
- If (Ord(LowCaseRec[I]) < 65) Or (Ord(LowCaseRec[I]) > 90) Then
- LowCaseRec[I] := LowCaseRec[I]
- Else
- Begin
- X := Ord(LowCaseRec[I]);
- LowCaseRec[I] := Char(X + $20)
- End;
- End;
- End;
-
- (*$I box.pas *)
-
- Begin
- SetScreen;
- DrawBox(11,4,62,11);
- Window(12,5,72,14);
- TextBackGround(LightGray);
- ClrScr;
- Screen := False;
- Printer := False;
- Disk := False;
-
- GotoXY(3,2);
- Writeln('Enter the name of the file to be converted to LOWER CASE');
- GotoXY(3,4);
- Readln(FileName);
- Assign(InputRec,FileName);
- {$I-} Reset(InputRec) {$I+};
- If IOresult <> 0 Then
- Begin
- GotoXY(3,6);
- TextColor(Red);
- Writeln('File ''',FileName,''' not found.');
- Halt
- End;
-
- Write;
- GotoXY(18,6);
- Write('Enter ONE of the following');
- GotoXY(18,7);
- Write('1 = Screen Listing');
- GotoXY(18,8);
- Write('2 = Printer Listing');
- GotoXY(18,9);
- Write('3 = Output to disk file');
- GotoXY(18,10);
- Readln(Answer);
-
- If Answer = '1' Then
- Screen := True
- Else
- If Answer = '2' Then
- Printer := True
- Else
- If Answer = '3' Then
- Begin
- Writeln;
- Writeln('Enter the disk file name');
- Readln(FileName);
- Assign(OutputRec,FileName);
- Rewrite(OutputRec);
- Disk := True
- End;
-
- Window(1,1,80,25);
- TextBackGround(Blue);
- ClrScr;
-
- Repeat
- Readln(InputRec,LowCaseRec);
- ChangeCase;
- If Screen Then
- Writeln(LowCaseRec);
- If Printer Then
- Writeln(Lst,LowCaseRec);
- If Disk Then
- Writeln(OutputRec,LowCaseRec);
- Until Eof(InputRec);
-
- Close(OutputRec)
-
- End.