主题:for i := 1 to m do readln(c[i]);中的readln(c[i])为多少
.program program3;
var c: array[1..3] of string[200];
s: array[1..10] of integer;
m, n, i: integer;
procedure numara;
var cod: boolean;
i, j, nr: integer;
begin
for j := 1 to n do begin
nr := 0; cod := true;
for i := 1 to m do
if c[i, j] = '1' then begin
if not cod then begin
cod := true; inc(s[nr]); nr := 0;
end
end
else begin
if cod then begin
nr := 1; cod := false;
end
else inc(nr);
end;
if not cod then inc(s[nr]);
end;
end;
begin
readln(m, n);
for i := 1 to m do readln(c[i]);
numara;
for i := 1 to m do
if s[i] <> 0 then write(i, ' ', s[i], ' ');
end.
"这个J的值是从1到N一直循环,从这个循环开始后J的值就不为0 "
那么n是多少呢???
你输入n是多少从头到尾n都不变
n根本没有定它的值!!! ]
从"readln(m, n);"这句话看出N你靠你自己输入的,而且无论是在主程序还是过程中N的值都不变
强调 for j := 1 to n do begin 这里是一开始的, readln(m, n);已经是后面的了!!!!!!!!!!!!!!
procedure numara;
var cod: boolean;
i, j, nr: integer;
begin
for j := 1 to n do begin
nr := 0; cod := true;
for i := 1 to m do
if c[i, j] = '1' then begin
if not cod then begin
cod := true; inc(s[nr]); nr := 0;
end
end
else begin
if cod then begin
nr := 1; cod := false;
end
else inc(nr);
end;
if not cod then inc(s[nr]);
end;
end;
这个是一个过程(如果不懂什么是过程建议你去翻书),是从后面的begin
readln(m, n);
for i := 1 to m do readln(c[i]);
numara;
for i := 1 to m do
if s[i] <> 0 then write(i, ' ', s[i], ' ');
end.
这一段开始后开始被调用,这段中的numara的意思就是调用前面这一段过程
如果输入 3 10 1110000111 1100001111 1000000011
readln(m, n);
for i := 1 to m do readln(c[i]);中的readln(c[i])为多少??
var c: array[1..3] of string[200];
s: array[1..10] of integer;
m, n, i: integer;
procedure numara;
var cod: boolean;
i, j, nr: integer;
begin
for j := 1 to n do begin
nr := 0; cod := true;
for i := 1 to m do
if c[i, j] = '1' then begin
if not cod then begin
cod := true; inc(s[nr]); nr := 0;
end
end
else begin
if cod then begin
nr := 1; cod := false;
end
else inc(nr);
end;
if not cod then inc(s[nr]);
end;
end;
begin
readln(m, n);
for i := 1 to m do readln(c[i]);
numara;
for i := 1 to m do
if s[i] <> 0 then write(i, ' ', s[i], ' ');
end.
"这个J的值是从1到N一直循环,从这个循环开始后J的值就不为0 "
那么n是多少呢???
你输入n是多少从头到尾n都不变
n根本没有定它的值!!! ]
从"readln(m, n);"这句话看出N你靠你自己输入的,而且无论是在主程序还是过程中N的值都不变
强调 for j := 1 to n do begin 这里是一开始的, readln(m, n);已经是后面的了!!!!!!!!!!!!!!
procedure numara;
var cod: boolean;
i, j, nr: integer;
begin
for j := 1 to n do begin
nr := 0; cod := true;
for i := 1 to m do
if c[i, j] = '1' then begin
if not cod then begin
cod := true; inc(s[nr]); nr := 0;
end
end
else begin
if cod then begin
nr := 1; cod := false;
end
else inc(nr);
end;
if not cod then inc(s[nr]);
end;
end;
这个是一个过程(如果不懂什么是过程建议你去翻书),是从后面的begin
readln(m, n);
for i := 1 to m do readln(c[i]);
numara;
for i := 1 to m do
if s[i] <> 0 then write(i, ' ', s[i], ' ');
end.
这一段开始后开始被调用,这段中的numara的意思就是调用前面这一段过程
如果输入 3 10 1110000111 1100001111 1000000011
readln(m, n);
for i := 1 to m do readln(c[i]);中的readln(c[i])为多少??