當前位置:編程學習大全網 - 編程軟體 - 豎式乘法 Pascal

豎式乘法 Pascal

我有原題,是JSOI2010夏令營B層次熱身的題B,比較簡單,主要是輸出格式,程序如下。(保證全對,我滿分)

輸出樣例

b.out

125

* 30

-----

0

375

-----

3750

(賦:輸出樣例,樓主的格式有問題)

程序:

i,l,t:longint;

nn,mm,ss:longint;

n,m,s:string;

begin

readln(nn,mm);

ss:=nn*mm;

str(nn,n);

str(mm,m);

str(ss,s);

l:=length(s)+1;

if length(m)<>1 then

begin

writeln(n:l);

write('*');writeln(m:l-1);

for i:=1 to l do write('-');writeln;

for i:=length(m) downto 1 do

begin

t:=(ord(m[i])-ord('0'))*nn;

writeln(t:l-(length(m)-i));

end;

for i:=1 to l do write('-');writeln;

writeln(ss:l);

end

else

begin

writeln(n:l);

write('*');writeln(m:l-1);

for i:=1 to l do write('-');writeln;

writeln(s:l);

end;

end.

  • 上一篇:深圳新綠島大廈小區周邊配套怎麽樣?
  • 下一篇:軟件接口對接需要學習什麽課程?
  • copyright 2024編程學習大全網