原有r和temp两个二维数组,他们的内容不同,大小相同,
我要把r[]经过一次处理.然后比较r和temp是否全等,如果他们其中
每一项r[i,j]都等于了temp[i,j],表明其已符合我的要求,结束即可;只要任有一个不相等,就不用比较下去,我将对r[]再进行处理,然后再比较.直至相等为止.
  这个大概要用的break,我不会写,请帮我完整写一次,多谢!!

解决方案 »

  1.   


    for i:=0 to N do
      for j:=0 to M do
        if r[i,j]<>temp[i,j] then
           abort;
      

  2.   

    我将对r[]再进行处理,然后再比较.直至相等为止.
    处理完还要从该点继续比较……用try和finally试试。
      

  3.   

    Result := CompareMem(R,Temp,(High(R) - Low(R) + 1) * SizeOf(R[0]))
      

  4.   

    仔细看了看你的问题如果他们其中
    每一项r[i,j]都等于了temp[i,j],表明其已符合我的要求
    呵呵,我觉得直接for i:=0 to N do
      for j:=0 to M do
        r[i,j]:=temp[i,j]   就能实现你的目的,哈哈
     
      

  5.   

    var
       i,j:integer;
    begin
          for i:=1 to total do
            for j:=1 to total do
            begin
              if temp[i,j]<>r[i,j] then
               begin
                       break;   /////////
                       xhcsh:=xhcsh+1;                   showmessage('不等');
                end
                else
                begin
                      arraybijiao:=1 ;            end;        end;
    end;在我打斜杠的地方,我用了break,我希望的效果时跳出if以及两个for,我想我这里肯定错了
    ,因该如何???
      

  6.   

    用Kingron(单身走我路……) 的方法吧
      

  7.   

    kingron大哥,你就是那个超级猛料收集者,真的万分景仰!
      

  8.   

    procedure compare();
    var
       i,j:integer;
    begin
          for i:=1 to total do
            for j:=1 to total do
            begin
              if temp[i,j]<>r[i,j] then
               begin
                      return; 
                        xhcsh:=xhcsh+1;                   showmessage('不等');
                end
                else
                begin
                      arraybijiao:=1 ;            end;        end;
    把比较单独写成一个函数或过程,比较不等时利用return跳出,再需比较时再调用这个过程就行了啊。
    你试一试吧。