L
loutian
Unregistered / Unconfirmed
GUEST, unregistred user!
我定义了一个集合类型和两个自定义函数,主要实现对定义的集合进行相与,或等逻辑运算,代码如下:
unit jihe;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm);
tcharset = set of char;
private
procedure displayresultset;
procedure settests;
{ Private declarations }
public
{ Public declarations }
const
a : tcharset =['a'..'m','r','s','u'];
b : tcharset =['b','g','h','l'..'z'];
subseta : tcharset =['a'..'g'];
superseta : tcharset =['a'..'m','r','s','u','v'];
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure tform1.displayresultset(operationname : string; const
charset : tcharset);//1.要求是=可是却找到procedure
var
i : char;
count : integer;
begin
memo1.lines.add('***'+operationname+'***');
count:=0;
for i:=low(char)to high(char)do
if (i in charset) then
begin
memo1.lines.add(i);
inc(count);
end;
memo1.lines.add('*** elem count: '+inttostr(count)+'***');
end;
procedure tform1.settests;
const
bools : array[boolean] of string=('is false','is true');
begin
memo1.clear;
displayresultset('union',a+b);
displayresultset('difference',a-b);
displayresultset('intersection',a*b);
memo1.lines.add('a<subseta (not a>=superseta)'+bools[not(a>=subseta)]);
memo1.lines.add('a>superseta (not a<=superseta)'+bools[not(a<=superseta)])
memo1.lines.add('a>=subseta '+bools[a>=subseta]);
memo1.lines.add('a<=superseta '+bools[a<=superseta]);
memo1.lines.add('a=b'+bools[a=b]);
memo1.lines.add('a<>b'+bools[a<>b]);
memo1.lines.add('''a'' in 'b'+bools['a' in b]);
end;
end.
当我运行时有很多问题
比如是
1.要求是=可是却找到procedure,15行
2.settests;不满足的向前或外部说明settests
3.没有定义public等
请问这些该怎么解决
unit jihe;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm);
tcharset = set of char;
private
procedure displayresultset;
procedure settests;
{ Private declarations }
public
{ Public declarations }
const
a : tcharset =['a'..'m','r','s','u'];
b : tcharset =['b','g','h','l'..'z'];
subseta : tcharset =['a'..'g'];
superseta : tcharset =['a'..'m','r','s','u','v'];
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure tform1.displayresultset(operationname : string; const
charset : tcharset);//1.要求是=可是却找到procedure
var
i : char;
count : integer;
begin
memo1.lines.add('***'+operationname+'***');
count:=0;
for i:=low(char)to high(char)do
if (i in charset) then
begin
memo1.lines.add(i);
inc(count);
end;
memo1.lines.add('*** elem count: '+inttostr(count)+'***');
end;
procedure tform1.settests;
const
bools : array[boolean] of string=('is false','is true');
begin
memo1.clear;
displayresultset('union',a+b);
displayresultset('difference',a-b);
displayresultset('intersection',a*b);
memo1.lines.add('a<subseta (not a>=superseta)'+bools[not(a>=subseta)]);
memo1.lines.add('a>superseta (not a<=superseta)'+bools[not(a<=superseta)])
memo1.lines.add('a>=subseta '+bools[a>=subseta]);
memo1.lines.add('a<=superseta '+bools[a<=superseta]);
memo1.lines.add('a=b'+bools[a=b]);
memo1.lines.add('a<>b'+bools[a<>b]);
memo1.lines.add('''a'' in 'b'+bools['a' in b]);
end;
end.
当我运行时有很多问题
比如是
1.要求是=可是却找到procedure,15行
2.settests;不满足的向前或外部说明settests
3.没有定义public等
请问这些该怎么解决