delphi函数问题。请指教
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
aa:array [1..15] of integer;
bb:array [1..1000]of set of 'A'..'O';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
s1,s2,k:string;
begin
for j:=1 to 1000 do begin
bb[j]:=[];
end;
i:=1;
table1.First;
while not table1.Eof do begin
s1:=table1.FieldByName('s').Text;
for j:=1 to length(s1) do begin
k:=copy(s1,j,1); // wrong here
include(bb[i],k);
end;
i:=i+1;
table1.Next;
end;
for i:=1 to 15 do begin
aa[j]:=0;
end;
for i:=1 to 1000 do begin
for j:=1 to 15 do begin
if chr(j+64) in bb[i] then aa[j]:=aa[j]+1;
end;
end;
end;
end.
当执行到include(bb[i],k);时出现类型不匹配错误,请问应该怎么修改
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
aa:array [1..15] of integer;
bb:array [1..1000]of set of 'A'..'O';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
s1,s2,k:string;
begin
for j:=1 to 1000 do begin
bb[j]:=[];
end;
i:=1;
table1.First;
while not table1.Eof do begin
s1:=table1.FieldByName('s').Text;
for j:=1 to length(s1) do begin
k:=copy(s1,j,1); // wrong here
include(bb[i],k);
end;
i:=i+1;
table1.Next;
end;
for i:=1 to 15 do begin
aa[j]:=0;
end;
for i:=1 to 1000 do begin
for j:=1 to 15 do begin
if chr(j+64) in bb[i] then aa[j]:=aa[j]+1;
end;
end;
end;
end.
当执行到include(bb[i],k);时出现类型不匹配错误,请问应该怎么修改
...全文
相关推荐
delphi延时函数(相当于sleep函数)
为了克服这个问题,Delphi提供了其他延时函数,如`TThread.Sleep()`和异步回调等方法,这些方法可以在延迟执行的同时保持界面的响应性。1.
delphi通过JNI调用JAVA函数
不过,需要注意的是,跨语言调用会带来额外的复杂性,包括类型映射、异常处理和内存管理等问题,开发者需要对两种语言都有深入的理解才能有效应对。
Delphi 函数,delphi函数参考大全,Delphi
在Delphi编程中,函数是至关重要的组成部分,它们是代码的可重用模块,执行特定任务并可能返回结果。下面将详细讨论Delphi函数的基本概念、类型以及如何使用。
关于delphi中真正四舍五入的问题
### 关于Delphi中真正四舍五入的问题在Delphi编程环境中,处理数值运算时,经常需要对浮点数进行四舍五入操作。
Delphi函数参考大全
《Delphi函数参考大全》是一本专为Delphi开发者量身打造的实用工具书,它提供了详尽且全面的Delphi函数使用指南。


