Pascal: const a:array [1..5,1..5] of integer = ((1,2,3,4,5), (6,7,8,9,10), (11,12,13,14,15), (16,17,18,19,20), (21,22,23,24,25)); var I,j:integer; begin for i:=1 to 5 do for j:=1 to 5 do write (a[I,j],' '); writeln; for i:=1 to 5 do begin for j:=1 to 5 do write (a[I,j]:3); writeln; end; readln; end.
C++: #include <iostream> #include <iomanip> using namespace std;
int main() { int a[5][5] = {{1,2,3,4,5}, {6,7,8,9,10}, {11,12,13,14,15}, {16,17,18,19,20}, {21,22,23,24,25},}; for (int I = 0; I<5; I++) for (int j = 0; j<5; j++) cout <<a[I][j] <<" "; cout <<endl; for (int I = 0; I<5; I++) { for (int j = 0; j<5; j++) cout <<setw(3) <<a[I][j]; cout <<endl; } return 0; }
const a:array [1..5,1..5] of integer = ((1,2,3,4,5),
(6,7,8,9,10),
(11,12,13,14,15),
(16,17,18,19,20),
(21,22,23,24,25));
var I,j:integer;
begin
for i:=1 to 5 do
for j:=1 to 5 do write (a[I,j],' ');
writeln;
for i:=1 to 5 do
begin
for j:=1 to 5 do write (a[I,j]:3);
writeln;
end;
readln;
end.
C++:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[5][5] = {{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15},
{16,17,18,19,20},
{21,22,23,24,25},};
for (int I = 0; I<5; I++)
for (int j = 0; j<5; j++)
cout <<a[I][j] <<" ";
cout <<endl;
for (int I = 0; I<5; I++)
{
for (int j = 0; j<5; j++)
cout <<setw(3) <<a[I][j];
cout <<endl;
}
return 0;
}