to jtchang,二叉树的中序线索化
  请你帮我看看下面这个程序,帮我修改一下,题目如上,
program xiansuohua(input,output);
  type
    thlinktp=^thrnodetp;
    thrnodetp=record
              data:integer;
              ltag,rtag:0..1;
              lchild,rchild:thlinktp
              end;
var
   x:integer;
   root,pre,thrt,bt,p,q,r,s:thlinktp;
procedure add(x :integer;var p:thlinktp);
   begin
     if p=nil
       then  begin
              new(p);
              with p^ do
                begin
                  data:=x;
                  lchild:=nil;
                  rchild:=nil
                  end
             end
             else with p^ do
               if x< data
                 then add(x,lchild)
                 else add(x,rchild)
              end;
  procedure inthread(p:thlinktp);
    begin
      if p<>nil then
        begin
          inthread(p^.lchild);
          if (pre<>nil) and (pre^.rtag=1) then pre^.rchild:=p;
          if p^.lchild=nil then
                      begin
                        p^.ltag:=1;
                        p^.lchild:=pre
                      end;
        if p^.rchild=nil then p^.rtag:=1;
        pre:=p;
        inthread(p^.rchild);
      end;
      end;

  procedure crt_inthlinked(var thrt:thlinktp;bt:thlinktp);
     begin
       new(thrt);
       thrt^.ltag:=0;
       thrt^.rtag:=1;
       thrt^.rchild:=thrt;
       if bt =nil then thrt^.lchild:=thrt
         else begin
                thrt^.lchild:=bt;
                pre:=thrt;
                inthread(bt);
                pre^.rchild:=thrt;
                pre^.rtag:=1;
                thrt^.rchild:=pre;
    end;
    end;
  procedure xiansuo(thrt:thlinktp);
    begin
      p:=thrt;
      while p<> nil do
        begin
          writeln(p^.data);
          p:=p^.rchild
        end;
        end;
  begin

    root:=nil;
    read(x);
    writeln(x:6);
    while x>=0 do
      begin
        add(x,root);
        read(x);
        writeln(x:6)
      end;
    writeln;
    crt_inthlinked(thrt,root);
    xiansuo(thrt);
  end.


to jtchang,
  请你帮我看看下面这个程序,帮我修改一下,题目如上,
program xiansuohua(input,output);
  type
    thlinktp=^thrnodetp;
    thrnodetp=record
              data:integer;
              ltag,rtag:0..1;
              lchild,rchild:thlinktp
              end;
var
   x:integer;
   root,pre,thrt,bt,p,q,r,s:thlinktp;
procedure add(x :integer;var p:thlinktp);
   begin
     if p=nil
       then  begin
              new(p);
              with p^ do
                begin
                  data:=x;
                  lchild:=nil;       
                  rchild:=nil
                  end
             end
             else with p^ do
               if x< data
                 then add(x,lchild)
                 else add(x,rchild)
              end;
  procedure inthread(p:thlinktp);
    begin
      if p<>nil then
        begin
          inthread(p^.lchild);
          if (pre<>nil) and (pre^.rtag=1) then pre^.rchild:=p;
          if p^.lchild=nil then
                      begin
                        p^.ltag:=1;
                        p^.lchild:=pre
                      end;
        if p^.rchild=nil then p^.rtag:=1;
        pre:=p;
        inthread(p^.rchild);
      end;
      end;

  procedure crt_inthlinked(var thrt:thlinktp;bt:thlinktp);
     begin
       new(thrt);
       thrt^.ltag:=0;
       thrt^.rtag:=1;
       thrt^.rchild:=thrt;
       if bt =nil then thrt^.lchild:=thrt
         else begin
                thrt^.lchild:=bt;
                pre:=thrt;
                inthread(bt);
                pre^.rchild:=thrt;
                pre^.rtag:=1;
                thrt^.rchild:=pre;
    end;
    end;
  procedure xiansuo(thrt:thlinktp);
    begin
      p:=thrt;
      while p<> nil do
        begin
          writeln(p^.data);
          p:=p^.rchild
        end;
        end;
  begin

    root:=nil;
    read(x);
    writeln(x:6);
    while x>=0 do
      begin
        add(x,root);
        read(x);
        writeln(x:6)
      end;
    writeln;
    crt_inthlinked(thrt,root);
    xiansuo(thrt);
  end.