标题:求助:如何实现文件输入内容
只看楼主
klh111111
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-10-25
 问题点数:0 回复次数:3 
求助:如何实现文件输入内容

void __fastcall TForm1::FormPaint(TObject *Sender)
{
int i,k9,L0,E0,NJP,NPP,NRES,IJ[40][1],ret[40];
float EE,XY[40][2],BH[40][3],RES[40][2],JP[40][2],PP[40][4];
FILE*f1 ;
f1=fopen("01钢架.dat","r");
k9=StrToInt(InputBox("简单遗传算法钢架","键盘输入数据请输入2,文件输入请输入1:",""));
if(k9==1){
do{
fscanf(f1,"%d%d%d%d%d%f",&L0,&E0,&NJP,&NPP,&NRES,&EE);
for(i=1;i<=L0;i++)
fscanf(f1,"%f%f",&XY[1],&XY[2]);
for(i=1;i<=E0;i++)
fscanf(f1,"%d%d",&IJ[1],&IJ[2]);
for(i=1;i<=L0;i++)
fscanf(f1,"%d",&ret);
Refresh();
Canvas->TextOut(10,10,"结构约束、几何构成简图");
for(i=1;i<=E0;i++)
{
Canvas->Pen->Color=clBlack;
Canvas->Pen->Width=2;
Canvas->MoveTo(int(XY[IJ[1]][1])*20+50,300-int(XY[IJ[1]][2])*20+20);
Canvas->LineTo(int(XY[IJ[2]][1])*20+50,300-int(XY[IJ[2]][2])*20+20);
}
for(i=1;i<=L0;i++){
switch(ret){
case 1:
Canvas->Pen->Width=10;
Canvas->MoveTo(int(XY[1])*20+45,300-int(XY[2])*20+20);
Canvas->LineTo(int(XY[1])*20+55,300-int(XY[2])*20+20);
break;
case 2:
Canvas->Pen->Width=2;
Canvas->MoveTo(int(XY[1])*20+50,300-int(XY[2])*20+20);
Canvas->LineTo(int(XY[1])*20+40,300-int(XY[2])*20+40);
Canvas->LineTo(int(XY[1])*20+60,300-int(XY[2])*20+40);
Canvas->LineTo(int(XY[1])*20+50,300-int(XY[2])*20+20);
break;
}
}
i=Application->MessageBox("结构约束、几何构成简图正确吗?","结构分析",36);
}while(i!=6);
for(i=1;i<=E0;i++)
fscanf(f1,"%f%f%f",&BH[1],&BH[2],&BH[3]);
for(i=1;i<=NRES;i++)
fscanf(f1,"%f%f",&RES[1],&RES[2]);
if(NJP!=0)
for(i=1;i<=NJP;i++)
fscanf(f1,"%f%f",&JP[1],&JP[2]);
if(NPP!=0)
for(i=1;i<=NPP;i++)
fscanf(f1,"%f%f%f%f",&PP[1],&PP[2],&PP[3],&PP[4]);
}else{
do{
L0=StrToInt(InputBox("简单遗传算法钢架","请输入节点数:",""));
E0=StrToInt(InputBox("简单遗传算法钢架","请输入单元数:",""));
NJP=StrToInt(InputBox("简单遗传算法钢架","请输入节点载荷数:",""));
NPP=StrToInt(InputBox("简单遗传算法钢架","请输入非节点载荷数:",""));
NRES=StrToInt(InputBox("简单遗传算法钢架","请输入约束数:",""));
EE=StrToFloat(InputBox("简单遗传算法钢架","请输入弹性模量:",""));
for(i=1;i<=L0;i++){
XY[1]=StrToFloat(InputBox("简单遗传算法钢架","请输入水平坐标:",""));
XY[2]=StrToFloat(InputBox("简单遗传算法钢架","请输入垂直坐标:",""));}
for(i=1;i<=E0;i++){
IJ[1]=StrToInt(InputBox("简单遗传算法钢架","请输入I节点号:",""));
IJ[2]=StrToInt(InputBox("简单遗传算法钢架","请输入J节点号:",""));}
Refresh();
Canvas->TextOut(10,10,"计算简图");
for(i=1;i<=E0;i++)
{Canvas->MoveTo(int(XY[IJ[1]][1])*20+50,200-int(XY[IJ[1]][2])*20+20);
Canvas->LineTo(int(XY[IJ[2]][1])*20+50,200-int(XY[IJ[2]][2])*20+20);}
i=Application->MessageBox("结构计算简图正确吗?","结构分析",36);
}while(i!=6);
for(i=1;i<=E0;i++){
BH[1]=StrToFloat(InputBox("简单遗传算法钢架","请输入截面积:",""));
BH[2]=StrToFloat(InputBox("简单遗传算法钢架","请输入惯性矩:",""));
BH[3]=StrToFloat(InputBox("简单遗传算法钢架","请输入抗弯系数:",""));}
for(i=1;i<=NRES;i++){
RES[1]=StrToFloat(InputBox("简单遗传算法钢架","请输入约束位移:",""));
RES[2]=StrToFloat(InputBox("简单遗传算法钢架","请输入约束序号:",""));}
if(NJP!=0)
for(i=1;i<=NJP;i++){
JP[1]=StrToFloat(InputBox("简单遗传算法钢架","请输入节点载荷:",""));
JP[2]=StrToFloat(InputBox("简单遗传算法钢架","请输入节点序号:",""));}
if(NPP!=0)
for(i=1;i<=NPP;i++){
PP[1]=StrToFloat(InputBox("简单遗传算法钢架","请输入非节点荷载值:",""));
PP[2]=StrToFloat(InputBox("简单遗传算法钢架","请输入坐标:",""));
PP[3]=StrToFloat(InputBox("简单遗传算法钢架","请输入非节点荷载单元:",""));
PP[4]=StrToFloat(InputBox("简单遗传算法钢架","请输入非节点荷载类型:",""));}
}
哪位高手能帮我运行下看问题出在哪了.我是新手,现在正在做工程,我运行显示的错误信息提示内容是:
Debugger Exception Notification
Project Project1.exe raised exception class EAccess Violation with

message"Access violation at address326663F0 in model'CC3260MT.DLL'.Read

of address F86B61B8".Process stopped.Use step or Run to continue.
什么原因,急切希望得到大家的帮助.谢谢!

搜索更多相关主题的帖子: 文件 NPP Sender 输入 
2007-10-25 10:37
zalem
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2007-10-17
得分:0 

........

2007-10-25 11:32
chengbo226
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-10-7
得分:0 
好复杂啊!!!!!!!!!
2007-10-25 11:59
leetowin
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-10-25
得分:0 
代码看不懂
2007-10-25 12:22



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-180629-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.238557 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved