B
billson
Unregistered / Unconfirmed
GUEST, unregistred user!
下面是一个例子代码,运行时产生错误:
[Error] Project1.dpr(11): Illegal character in input file: ' ' ($A1A1)
为什么?
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
TDate=class
public
Month,Day,Year:Integer;
procedure SetValue(m,d,y:Integer)
//系统说这行出错,下面还有好几行有类似错误,错误现象见上面
function LeapYear:Boolean;
end;
procedure TDate.SetValue(m,d,y:Integer);
begin
Year:=y;
Month:=m;
Day:=d;
end;
function Tdate.LeapYear:Boolean;
begin
if (Year mod 4 <> 0) then
LeapYear := False
else if (Year mod 100 <> 0)
LeapYear := True
else if (Year mod 400 <> 0)
LeapYear := False
else
LeapYear := True;
end;
var ADay:TDate;
begin
{ TODO -oUser -cConsole Main : Insert code here }
ADay:=TDate.Create;
ADay.SetValue(5,20,2002);
If ADay.LeapYear Then
Writeln('It is a LeapYear')
Else
Writeln('It is not LeapYear');
ADay.Destroy;
ReadLn;
end.
[Error] Project1.dpr(11): Illegal character in input file: ' ' ($A1A1)
为什么?
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
TDate=class
public
Month,Day,Year:Integer;
procedure SetValue(m,d,y:Integer)
//系统说这行出错,下面还有好几行有类似错误,错误现象见上面
function LeapYear:Boolean;
end;
procedure TDate.SetValue(m,d,y:Integer);
begin
Year:=y;
Month:=m;
Day:=d;
end;
function Tdate.LeapYear:Boolean;
begin
if (Year mod 4 <> 0) then
LeapYear := False
else if (Year mod 100 <> 0)
LeapYear := True
else if (Year mod 400 <> 0)
LeapYear := False
else
LeapYear := True;
end;
var ADay:TDate;
begin
{ TODO -oUser -cConsole Main : Insert code here }
ADay:=TDate.Create;
ADay.SetValue(5,20,2002);
If ADay.LeapYear Then
Writeln('It is a LeapYear')
Else
Writeln('It is not LeapYear');
ADay.Destroy;
ReadLn;
end.