计算结构力学自编平面桁架
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
平面桁架
程序:
#include "stdio.h"
#include "math.h"
#define unitmax 30
#define pointmax 30
#define matermax 10
#define Pmaxnum 20
#define bindmax 20
main()
{
int unit[unitmax][4],bind[bindmax][3],number[5];
float point[pointmax][2],material[matermax][2],P[Pmaxnum][3];
float allarray[pointmax*2][pointmax*2];
void readdata(int unit[unitmax][4],float point[pointmax][2],int number[5],
int bind[bindmax][3],float material[matermax][2],float P[Pmaxnum][3]);
void all(float point[pointmax][2],int unit[unitmax][4],float material[matermax][2], int number[5],float allarray[][pointmax*2]);
void equa(float allarray[][pointmax*2],float P[Pmaxnum][3],int bind[][3],
int number[]);
void result(int unit[unitmax][4],float point[pointmax][2],int number[5],
float material[matermax][2],float allarray[][pointmax*2]);
readdata(unit,point,number,bind,material,P);
all(point,unit,material,number,allarray);
equa(allarray,P,bind,number);
result(unit,point,number,material,allarray);
}
/******************************************************************/ void readdata(int unit[unitmax][4],float point[pointmax][2],int number[5],
int bind[bindmax][3],float material[matermax][2],float P[Pmaxnum][3])
{
FILE *fp;
int pointnum,unitnum,maternum,Pnum,bindnum,no_use,i,j,k,n,m;
if((fp=fopen("data.txt","r"))==NULL)
{printf("data file can't be opened,please create it");
exit(0);return;}
for(i=0;i<=4;i++)
if(fscanf(fp,"%d",&number[i])==EOF)
{printf("file error");fclose(fp);}
pointnum=number[0];
unitnum=number[1] ;
maternum=number[2];
Pnum=number[3];
bindnum=number[4];
for(i=0;i fscanf(fp,"%d %f %f",&k,&point[i][0],&point[i][1]); for(i=0;i if(fscanf(fp,"%d %d %d %d\n",&unit[i][0],&unit[i][1],&unit[i][2],&unit[i][3])==EOF) {printf("file error\n");fclose(fp);} for(i=0;i if(fscanf(fp,"%d %g %g\n",&k,&material[i][0],&material[i][1])==EOF) {printf("file error\n");fclose(fp);} for(i=0;i fscanf(fp,"%d %f %f %f\n",&k,&P[i][0],&P[i][1],&P[i][2]); for(i=0;i if(fscanf(fp,"%d %d %d %d\n",&k,&bind[i][0],&bind[i][1],&bind[i][2])==EOF) {printf("file error\n");fclose(fp);} fclose(fp); return; } /*OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPPPP*/ void all(float point[pointmax][2],int unit[unitmax][4],float material[matermax][2], int number[5],float allarray[][pointmax*2]) {