回 帖 发 新 帖 刷新版面

主题:这个是什么意思啊?~

在定义类型中有longint,这个是什么意思啊?

还有在程序中出现inc是什么意思啊?

在04年的程序中曾出现过这个题~是什么意思啊?
.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.


这里就有inc~那句是什么意思?

回复列表 (共3个回复)

沙发

inc(nr)就是把nr加一,相当于C里面的nr++;
longint是32位有符号整形变量,可以表示-2^32 ~ 2^32-1的范围的整数

板凳


谢了!

3 楼

楼主   


.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.
请问一开始那里for j := 1 to n do begin ,j的值不是0吗?
那么怎么好象不能循环的感觉?

我来回复

您尚未登录,请登录后再回复。点此登录或注册