#1241: 請教,誰能幫忙看一下,感激不盡!

Unknown User

c014. 10035 - Primary Arithmetic -- UVa10035 | From: [58.248.216.31] | 發表日期 : 2009-01-23 21:57

程序如下:

program c014;
var
   a,b:array[1..10] of longint;
   n,m,i,sum:longint;
   s:string;
begin
   n:=1; m:=1;
   while (n<>0)and(m<>0) do
   begin
      fillchar(a,sizeof(a),0);
      fillchar(b,sizeof(b),0);
      sum:=0;
      readln(n,m);
      if (n<>0)and(m<>0)then
      begin
         str(n,s);
         for i:=length(s) downto 1 do a[1+length(s)-i]:=ord(s[i])-48;
         str(m,s);
         for i:=length(s) downto 1 do b[1+length(s)-i]:=ord(s[i])-48;
         for i:=1 to 10 do
         begin
            a[i]:=a[i]+b[i];
            if a[i]>=10 then begin inc(sum); inc(a[i+1]); end;
         end;
         case sum of
            0:writeln('No carry operation.');
            1:writeln('1 carry operation.');
            else writeln(sum,' carry operations.');
         end;
      end;
   end;
end.

系統總是提示:您的程式未完成所有的輸出!!

 
ZeroJudge Forum