分类：电脑/网络-程序设计
问题：我在delphi7下编的小程序,老是出问题?unitfourth 
unfourth;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls;typeTForm1=class(TForm)Edit1:TEdit;Button1:TButton;Label1:TLabel;procedureButton1Click( );private{Privatedeclarations}public{Publicdeclarations}end;varForm1:TForm1;var1:inunfourth;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls;typeTForm1=class(TForm)Edit1:TEdit;Button1:TButton;Label1:TLabel;procedureButton1Click( );private{Privatedeclarations}public{Publicdeclarations}end;varForm1:TForm1;var1:integer;implementation{$R*.dfm}procedureTForm1.Button1Click( );beginvar1:=strtoint(edit1.Text);ifvar1=1,3,5,7,9thenlabel1.Caption:=inttostr(var1)+'是奇数'elseifvar1=0,2,4,6,8thenlabel1.Caption:=inttostr(var1)+'是偶数'elseifvar1=10..100thenlabel1.Caption:=inttostr(var1)+'是10到100之间的数'elselabel1.Caption:=inttostr(var1)+'是大于100的数或者是负数'end;end.
回答：语法错误

在Delphi中的集合不是这么用的
要用[]括起来
代码改为

if var1 in [1,3,5,7,9] then
label1.Caption:=inttostr(var1)+'是奇数'
else if var1 in [0,2,4,6,8] then
label1.Caption:=inttostr(var1)+'是偶数'
else if var1 in [10..100] then
label1.Caption:=inttostr(var1)+'是10到100之间的数'
else
label1.Caption:=inttostr(var1)+'是大于100的数 或者是负数'

在Delphi7.0中编译通过