谁能举个最简单的数组的例子啊?
发布网友
发布时间:2022-05-11 13:17
我来回答
共2个回答
热心网友
时间:2023-10-13 03:11
unit ufrm_main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, dxCntner, dxEditor, dxExEdtr,
dxEdLib,inifiles;
type
Tfrm_main = class(TForm)
Timer1: TTimer;
Panel1: TPanel;
PL_SET: TPanel;
btn_go: TBitBtn;
btn_stop: TBitBtn;
Label3: TLabel;
CB_AUTOLAN: TComboBox;
Label4: TLabel;
Label5: TLabel;
BitBtn1: TBitBtn;
Label6: TLabel;
Label7: TLabel;
BC: TLabel;
Label8: TLabel;
Label9: TLabel;
Label1: TLabel;
X: TEdit;
Y: TEdit;
Label2: TLabel;
Label10: TLabel;
Timer2: TTimer;
CB_JNTIME: TEdit;
CB_LANTIME: TEdit;
LD1: TEdit;
LD2: TEdit;
LD3: TEdit;
LD4: TEdit;
X1: TEdit;
Y1: TEdit;
X2: TEdit;
Y2: TEdit;
btn_setup: TBitBtn;
procere Timer1Timer(Sender: TObject);
procere btn_goClick(Sender: TObject);
procere btn_stopClick(Sender: TObject);
procere FormCreate(Sender: TObject);
procere BitBtn1Click(Sender: TObject);
procere btn_setupClick(Sender: TObject);
procere Timer2Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_main: Tfrm_main;
auto_add_lan: boolean; //是否需要自动加蓝
in_use: boolean; //是否使用挂
nowpos: Tpoint;
count:integer=0; //计数器,全局变量
implementation
{$R *.dfm}
procere Tfrm_main.btn_goClick(Sender: TObject);
begin
in_use := true;
btn_go.Enabled := false;
btn_stop.Enabled := true;
BC.Visible := false;
PL_SET.Enabled := false; //运行后不能改设置
end;
procere Tfrm_main.btn_stopClick(Sender: TObject);
begin
in_use := false;
btn_stop.Enabled := false;
btn_go.Enabled := true;
PL_SET.Enabled := true; //不运行的时后可以改设置
end;
procere Tfrm_main.FormCreate(Sender: TObject);
var l_inifile:Tinifile;
l_filename:string;
l_path:string;
begin
//==============初始化数据======================
in_use := false; //开始不可用
auto_add_lan := true; //是否需要自动加蓝
CB_JNTIME.Text := '2000';
CB_LANTIME.Text := '20000';
LD1.Text := '150';
LD2.Text := '50';
LD3.Text := '150';
LD4.Text := '50';
//==============================================
l_filename:='RXJH_WJM.ini';
l_path:=extractfilepath(application.ExeName);
l_filename:=l_path+l_filename;
l_inifile:=Tinifile.Create(l_filename);
try
CB_JNTIME.Text:=l_inifile.ReadString('RXJH_WJM','JNTIME',CB_JNTIME.Text);
CB_LANTIME.Text:=l_inifile.ReadString('RXJH_WJM','LANTIME',CB_LANTIME.Text);
CB_AUTOLAN.ItemIndex:=l_inifile.ReadInteger('RXJH_WJM','AUTOLAN',CB_AUTOLAN.ItemIndex);
X1.Text:=l_inifile.ReadString('RXJH_WJM','X1',X1.Text);
Y1.Text:=l_inifile.ReadString('RXJH_WJM','Y1',Y1.Text);
X2.Text:=l_inifile.ReadString('RXJH_WJM','X2',X2.Text);
Y2.Text:=l_inifile.ReadString('RXJH_WJM','Y2',Y2.Text);
LD1.Text:=l_inifile.ReadString('RXJH_WJM','LD1',LD1.Text);
LD2.Text:=l_inifile.ReadString('RXJH_WJM','LD2',LD2.Text);
LD3.Text:=l_inifile.ReadString('RXJH_WJM','LD3',LD3.Text);
LD4.Text:=l_inifile.ReadString('RXJH_WJM','LD4',LD4.Text);
except
;
end;
l_inifile.free;
end;
procere Tfrm_main.Timer1Timer(Sender: TObject);
begin
if not in_use then exit;
count := count + 1;
if (count mod (strtoint(CB_LANTIME.Text)))=1 then
begin
if not auto_add_lan then exit;//如果不自动加蓝就退出
SetCursorPos(strtoint(X2.Text),strtoint(Y2.Text));
sleep(500);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
sleep(strtoint(LD3.Text));
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
sleep(strtoint(LD4.Text));
SetCursorPos(nowpos.X,nowpos.Y);
end else
if (count mod (strtoint(CB_JNTIME.Text)))=1 then
begin
SetCursorPos(strtoint(X1.Text),strtoint(Y1.Text));
sleep(500);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
sleep(strtoint(LD1.Text));
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
sleep(strtoint(LD2.Text));
SetCursorPos(nowpos.X,nowpos.Y);
end;
if count > 10*strtoint(CB_LANTIME.Text) then count:=0;
end;
procere Tfrm_main.BitBtn1Click(Sender: TObject);
var a: double;
b: integer;
l_inifile:Tinifile;
l_filename:string;
l_path:string;
begin
if CB_AUTOLAN.ItemIndex = 0 then auto_add_lan := true else auto_add_lan := false; //是否需要加蓝
try
if (strtoint(CB_JNTIME.Text)<=0) or (strtoint(CB_LANTIME.Text)<=0) or (strtoint(LD1.Text)<=0) or (strtoint(LD2.Text)<=0) or (strtoint(LD3.Text)<=0) or (strtoint(LD4.Text)<=0) then
begin
showmessage('数据输入不合法!请重新输入!');
exit;
end;
if (strtoint(X1.Text)<=0) or (strtoint(X2.Text)<=0) or (strtoint(Y1.Text)<=0) or (strtoint(Y2.Text)<=0) then
begin
showmessage('数据输入不合法!请重新输入!');
exit;
end;
except
showmessage('数据输入不合法!请重新输入!');
exit;
end;
BC.Visible := true;
l_filename:='RXJH_WJM.ini';
l_path:=extractfilepath(application.ExeName);
l_filename:=l_path+l_filename;
l_inifile:=Tinifile.Create(l_filename);
try
l_inifile.WriteString('RXJH_WJM','JNTIME',CB_JNTIME.Text);
l_inifile.WriteString('RXJH_WJM','LANTIME',CB_LANTIME.Text);
l_inifile.WriteInteger('RXJH_WJM','AUTOLAN',CB_AUTOLAN.ItemIndex);
l_inifile.WriteString('RXJH_WJM','X1',X1.Text);
l_inifile.WriteString('RXJH_WJM','Y1',Y1.Text);
l_inifile.WriteString('RXJH_WJM','X2',X2.Text);
l_inifile.WriteString('RXJH_WJM','Y2',Y2.Text);
l_inifile.WriteString('RXJH_WJM','LD1',LD1.Text);
l_inifile.WriteString('RXJH_WJM','LD2',LD2.Text);
l_inifile.WriteString('RXJH_WJM','LD3',LD3.Text);
l_inifile.WriteString('RXJH_WJM','LD4',LD4.Text);
except
;
end;
l_inifile.free;
end;
procere Tfrm_main.btn_setupClick(Sender: TObject);
begin
if PL_SET.Visible then
begin
PL_SET.Visible := false;
frm_main.Height := 57;
end else
begin
PL_SET.Visible := true;
frm_main.Height := 303;
end;
end;
procere Tfrm_main.Timer2Timer(Sender: TObject);
begin
getcursorpos(nowpos);
X.Text := inttostr(nowpos.X);
Y.Text := inttostr(nowpos.Y);
end;
end.
热心网友
时间:2023-10-13 03:12
你要的是什么例子?
int a[10];
赋值scanf("%d",a+1);
a[0]=5;