program imagen;
{ generates a random binary image
  Andreas Herrmann  27 Jan 1987 }

const MAXSIZE=64;

var size: integer;
    line: string[MAXSIZE];
    i,j:  integer;

var finame: string[14];
    str1:   string[1];
    str2:   string[2];
    datei:  text;

begin { imagen }

finame:='IMAGE.';
write('Image size: ');  readln(size);
str(size,str2);
insert(str2,finame,7);
writeln('Filename is ',finame);

assign(datei,finame);
{if Ioresult0 then}
    Rewrite(datei);

for i:=1 to size do
    begin
    for j:=1 to size do
        begin
        str(Round(Random):1,str1);
        insert(str1,line,j);
        end;
    writeln(copy(line,1,size));
    writeln(datei,copy(line,1,size));
    end;

close(datei);

end. { imagen }

