编译出错:ARRAY TYPE REQUIRED, 请问:怎么办?谢谢!
早上好!某单元在以下行出错: CCSX[i,2]:=(2*rc[i]+tc[i])*(ra[i,2]-rc[i])*sin(HCAM[i,2]*pi/180)/(2*rc[i]+tc[i,2]); 错误是ARRAY TYPE REQUIRED,请问:怎么办?谢谢! 单元如下:unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,dwg,excels,StdCtrls;
const Max_arch = 20;
type
array20 = array[1..Max_arch] of real;
array20X2 = array[1..Max_arch,1..2] of real;
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private { Private declarations }
public { Public declarations }
end;
var
Ele,Rc,Tc,DYUA : array20;
//Ele[i]是从坝底(i=1)到坝顶(i=narch)的各拱圈高程
//Rc是从坝底(i=1)到坝顶(i=narch)的各拱圈中拱的中心半径(m)Radius of Crown cantilever
//Tc是从坝底(i=1)到坝顶(i=narch)的拱冠厚度THICK
//DYUA是从坝底(i=1)到坝顶(i=narch)的上游面与坝轴线间距
HCAM,HCA : array20X2;
//HCAM[i,1] 中拱的左岸半中心角 Half Central Angle of middle arch
//HCAM[i,2] 中拱的右岸半中心角 Half Central Angle of middle arch
//HCA[i,1] 左岸半中心角 Half Central Angle
//HCA[i,2] 右岸半中心角 Half Central Angle
Ra,Ta,CCSX,CCSY : array20X2;
//Ra[i,1]是左岸从坝底(i=1)到坝顶(i=narch)的肩拱半径 Radius of arch Abutment
//Ra[i,2]是右岸从坝底(i=1)到坝顶(i=narch)的肩拱半径 Radius of arch Abutment
//Ta[i,1]是左岸从坝底(i=1)到坝顶(i=narch)的拱端厚度 Radius of arch Abutment
//Ta[i,2]是右岸从坝底(i=1)到坝顶(i=narch)的拱端厚度 Radius of arch Abutment
//CCSX[i,1]是左岸肩拱圆心(点M)的X坐标
//CCSY[i,1]是左岸肩拱圆心(点M)的Y坐标
//CCSX[i,2]是右岸肩拱圆心(点L)的X坐标
//CCSY[i,2]是右岸肩拱圆心(点L)的Y坐标
XUMA,YUMA,XDMA,YDMA : array20X2;
//XUMA=X coordinate of Up points of middle arch dam
//YUMA=Y coordinate of Up points of middle arch dam
//XDMA=X coordinate of Down points of middle arch dam
//YDMA=Y coordinate of Down points of middle arch dam
XUSA,YUSA,XDSA,YDSA : array20X2;
//XUSA=X coordinate of Up points of side arch dam Abutment
//YUSA=Y coordinate of Up points of side arch dam Abutment
//XDSA=X coordinate of Down points of side arch dam Abutment
//YDSA=Y coordinate of Down points of side arch dam Abutment
Form1: TForm1;
implementation
uses Comobj;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
i,Narch :integer;
Curexcel : string;
Fexcel :Variant; //EXCEL对象
ouf :Textfile;
t0,t1 :real;
begin
try
begin
Fexcel:= CreateOleObject('Excel.Application');
Fexcel.DisplayAlerts := False; Fexcel.workbooks.Open(extractfilepath(Application.exeName)+'拱坝.xls');
Fexcel.WorkSheets[1].Activate; // 设置第1个工作表为活动工作表
Fexcel.Visible := False; Narch:= StrToInt(Fexcel.Cells[3,7].Value);
for i:=1 to narch do
begin
Ele[i]:=StrToFloat(Fexcel.Cells[7+narch-i,1].Value);
Rc[i]:=StrToFloat(Fexcel.Cells[7+narch-i,2].Value);
Tc[i]:=StrToFloat(Fexcel.Cells[7+narch-i,3].Value);
DYUA[i]:=StrToFloat(Fexcel.Cells[7+narch-i,4].Value);
HCAM[i,1]:=StrToFloat(Fexcel.Cells[7+narch-i,5].Value); //左岸中拱角度
HCAM[i,2]:=StrToFloat(Fexcel.Cells[7+narch-i,6].Value); //右岸中拱角度
Ta[i,1]:=StrToFloat(Fexcel.Cells[7+narch-i,7].Value);
Ta[i,2]:=StrToFloat(Fexcel.Cells[7+narch-i,8].Value);
Ra[i,1]:=StrToFloat(Fexcel.Cells[7+narch-i,9].Value);
Ra[i,2]:=StrToFloat(Fexcel.Cells[7+narch-i,10].Value);
HCA[i,1]:=StrToFloat(Fexcel.Cells[7+narch-i,11].Value); //左岸半中心角
HCA[i,2]:=StrToFloat(Fexcel.Cells[7+narch-i,12].Value); //右岸半中心角
CCSX[i,2]:=(2*rc[i]+tc[i])*(ra[i,2]-rc[i])*sin(HCAM[i,2]*pi/180)/(2*rc[i]+tc[i,2]);
//点L的X坐标
CCSY[i,2]:=DYUA[i]-rc[i]-tc[i]/2-(2*rc[i]+tc[i])*(ra[i,2]+rc[i])*cos(HCAM[i,2]*pi/180)/(2*rc[i]+tc[i,2]);
//点L的Y坐标
CCSX[i,1]:=-(2*rc[i]+tc[i])*(ra[i,1]-rc[i])*sin(HCAM[i,1]*pi/180)/(2*rc[i]+tc[i,1]);
//点M的X坐标
CCSY[i,1]:=DYUA[i]-rc[i]-tc[i]/2-(2*rc[i]+tc[i])*(ra[i,1]+rc[i])*cos(HCAM[i,1]*pi/180)/(2*rc[i]+tc[i,1]);
//点M的Y坐标
end;
Fexcel.WorkBooks.Close; //23) 关闭工作簿
Fexcel.Quit; //24) 退出 Excel:
end;
except
Application.MessageBox('导入数据出错!请检查文件的格式是否正确!', '提示信息', MB_OK+MB_ICONASTERISK+MB_DEFBUTTON1+MB_APPLMODAL);
Fexcel.Quit;
Exit;
end;
AssignFile(ouf,'d.txt');
{$I-} reset(ouf);
{$I+} rewrite(ouf);
for i:=1 to narch do
begin
writeln(ouf,CCSX[i,2]);
writeln(ouf,CCSY[i,2]);
writeln(ouf,CCSX[i,1]);
writeln(ouf,CCSY[i,1]);
end;
closeFile(ouf);
end;
end.