程序如下:
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.
系統總是提示:您的程式未完成所有的輸出!!