pascal编程题 数组类型
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/12 14:31:37
pascal编程题 数组类型
A:——————————————B:
1 2 3 1 4 7 10
4 5 6 2 5 8 11
7 8 9 3 6 9 12
10 11 12
把A转制为B 谁能帮我做下啊
A:——————————————B:
1 2 3 1 4 7 10
4 5 6 2 5 8 11
7 8 9 3 6 9 12
10 11 12
把A转制为B 谁能帮我做下啊
for i:=1 to n do
for j:=1 to m do b[j,i]:=a[i,j];
再问: 完整的能不能打出来....
再答: //假设A数组长为N 宽为M 转换为宽为N长为M的数组B var a,b:array[0..100,0..100] of longint; n,m,i,j:longint; begin read(n,m); { for i:=1 to n do for j:=1 to m do read(a[i,j]); for i:=1 to n do for j:=1 to m do b[j,i]:=a[i,j]; } //花括号内内容可简化为 for i:=1 to n do for j:=1 to m do read(b[j,i]); for i:=1 to n do begin for j:=1 to m do write(b[i,j],' '); writeln; end; end.
for j:=1 to m do b[j,i]:=a[i,j];
再问: 完整的能不能打出来....
再答: //假设A数组长为N 宽为M 转换为宽为N长为M的数组B var a,b:array[0..100,0..100] of longint; n,m,i,j:longint; begin read(n,m); { for i:=1 to n do for j:=1 to m do read(a[i,j]); for i:=1 to n do for j:=1 to m do b[j,i]:=a[i,j]; } //花括号内内容可简化为 for i:=1 to n do for j:=1 to m do read(b[j,i]); for i:=1 to n do begin for j:=1 to m do write(b[i,j],' '); writeln; end; end.