看到一个打印金字塔的程序他是这样写的:
var
m,n:integer;
c:char;
begin
c:='*';
for m:=0 to 12 do
begin write(c:40-3*m);
for n:=1to 2*m do 
write(c:3);
writeln;
end;
writeln('金字塔打印完毕')
readln;
end.
想问下其中C:40是什么意思啊?
还有write(c:40-3*M)输出的是什么啊?

解决方案 »

  1.   

    C:40的意思是把变量C赋值40,并输出到屏幕,C:=40就是C赋值40,但是不输出到屏幕.
    write(c:40-3*M)意思是把40-(3M)的值赋值给C,输出的是 C:=值, 这个值就是40-(3M)的运算结果.
      

  2.   

    还是不懂啊,!如果C:40是输出C的值,40不是个integer吗,而C定义的为char啊,
    而且他的形状是这样啊
                                        *
                                   ***
                                  *****
                                 *******
    后面还有一些,
      

  3.   

    C:40的意思是把变量C赋值40,并输出到屏幕
    C:=40就是C赋值40,但是不输出到屏幕
    write(c:40-3*M)意思是把40-(3M)的值赋值给C,输出的是 C:=值, 这个值就是40-(3M)的运算结果
      

  4.   

    为什么会有如此多的人自己完全不懂也爱煞有介事的胡说八道,我一直以来都不能理解的是,这事儿对你自己有什么好处么?
    看这天马行空的样子想象力还挺丰富的,但是一看就是脑子不好使
    Write('A':2)
    Write(100:3)
    Write(123.456:4:2)
    这几种都能编译通过,难道也能是“把变量100赋值3,并输出到屏幕”?delphi的帮助里写的很清楚:
    A write parameter has the formOutExpr [: MinWidth [: DecPlaces ] ]where OutExpr is an output expression. MinWidth and DecPlaces are type integer expressions.MinWidth specifies the minimum field width, which must be greater than 0. Exactly MinWidth characters are written (using leading blanks if necessary) except when OutExpr has a value that must be represented in more than MinWidth characters. In that case, enough characters are written to represent the value of OutExpr. Likewise, if MinWidth is omitted, then the necessary number of characters is written to represent the value of OutExpr.DecPlaces specifies the number of decimal places in a fixed-point representation of one of the Real types. It can be specified only if OutExpr is one of the Real types, and if MinWidth is also specified. When MinWidth is specified, it must be greater than or equal to 0. Write with a character-type value:If MinWidth is omitted, the character value of OutExpr is written to the file. Otherwise, MinWidth - 1 blanks followed by the character value of OutExpr is written. Write with one of the integer type values:If MinWidth is omitted, the decimal representation of OutExpr is written to the file with no preceding blanks. If MinWidth is specified and its value is larger than the length of the decimal string, enough blanks are written before the decimal string to make the field width MinWidth.Write with one of the real type values:If OutExpr has one of the real type values, its decimal representation is written to the file. The format of the representation depends on the presence or absence of DecPlaces. 这东西也早有人翻译成中文了吧?自己不懂也别胡说八道误导别人啊
      

  5.   

    后面那个是占位宽度,DELPHI下很少用了(console可能会用),以前写PASCAL经常要用,呵呵。