unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
ord('A')  ///这里居然错了 什么情况?
end;end.

解决方案 »

  1.   

    X is a Delphi ordinal-type expression. The result is the ordinal position of X; its type is the smallest standard integer type that can hold all values of X's type.
    var
    i: Longint;
    begin
    i:=Ord('A');
    end;
      

  2.   

    longint??为什么要设置长的整数型?
      

  3.   

    hsmserver您的意思是不是ord一定要把结果返回出来?
      

  4.   

    inttostr(ord('A'));
    showmessage(inttostr(ord('A')));
    longint64位,
      

  5.   

    首先 双引号改成单引号其次,也是最主要的 delphi的错误提示已经很明确了
    Statement expected, but expression of type 'Integer' found估计翻开任何一本讲delphi语法的书 都会在前几页找到答案你这样写 跟
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    'adsf';
    end;有什么区别么?
      

  6.   

    靠 原来是csdn回复版式的问题 
    你告诉我为什么procedure   TForm1.Button1Click(Sender:   TObject); 
    begin 
    'adsf'; 
    end; 

    编译不通过 我就告诉你为什么procedure   TForm1.Button1Click(Sender:   TObject); 
    begin 
    ord('a'); 
    end; 
    ;
    编译通不过
      

  7.   

    inttostr(ord( 'A ')); 
    showmessage(inttostr(ord( 'A '))); 
    longint64位,解决了 谢谢