Category : Pascal Source Code
Archive   : STRING.ZIP
Filename : TXTFMT.PAS

 
Output of file : TXTFMT.PAS contained in archive : STRING.ZIP
program testformat;
uses crt,strings;
const maxlines=10;
var s:array [1..maxlines] of string;
t1:string;
i,len,lins,p:byte;

begin
i:=0;
writeln('This program will accept up to 10 lines of text and print it');
writeln('out as a right- and left-justified paragraph.');
repeat
inc(i);
writeln('Enter line ',i,', or a null to end input: '); readln(s[i]);
s[i]:=space(s[i],1);
until (s[i]='') or (i=maxlines) ;
if s[i]='' then dec(i);
lins:=i;
len:=30;
while len<80 do begin
writeln(copies('----+',len div 5));
i:=0; t1:='';
while i while (length(t1)<=len) and (i inc(i);
t1:=t1+s[i]+' ';
end;
while length(t1)>len do begin
p:=lastpos(' ',t1,len+1);
writeln(justify(left(t1,p,' '),len));
t1:=right(t1,length(t1)-p,' ');
end;
end;
writeln(t1);
writeln('Press enter to continue ...'); readln;
len:=len+20;
end;
end.



  3 Responses to “Category : Pascal Source Code
Archive   : STRING.ZIP
Filename : TXTFMT.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/