您好,欢迎光临本网站![请登录][注册会员]  
文件名称: c语言常用算法源代码
  所属分类: C
  开发工具:
  文件大小: 313kb
  下载次数: 0
  上传时间: 2009-06-29
  提 供 者: tianz*****
 详细说明: #include "stdio.h" #include "conio.h" #include "string.h" #define MAX 5000 int start,end,nodenum; void save1(); void save2(); void main() { FILE *fp1,*fp2,*fp3; float ver[50]; int t[14],i,j,m; int num_node[4]; int node_number; int n umber=0; float val[MAX]; char ch,ch1,ch2,s1[80],s2[80],s3[80],val_name[80]; float nodex[MAX],nodey[MAX],nodez[MAX]; int node2[MAX]; int *p1; float *px,*py,*pz,*pnode; int *pnode2; px=nodex;py=nodey;pz=nodez; pnode=val; clrscr(); printf("Please enter ele_node_data filename:(*.)"); gets(s1); if((fp1=fopen(s1,"r"))==NULL){ printf("\n\n\aCannot open the file or file not find!\n"); exit(1); } printf("Please enter Stress_out_data filename:(*.out)"); gets(s3); if((fp3=fopen(s3,"r"))==NULL){ printf("\n\n\aCannot open the file or file not find!\n"); exit(1); } if(strstr(s3,".out")==NULL) { printf("\n\aStress output filename error!Please input again!(*.out)\n"); exit(0); } printf("Reading datas......\n"); for(i=0;i<=18;i++) fscanf(fp1,"%c",&ch); fscanf(fp1,"%f%d",&ver[0],&nodenum); printf("\t****************************\n"); printf("\tThe model have %d nodes...\n",nodenum); printf("\t****************************\n"); for(i=0;i<=13;i++) fscanf(fp1,"%d",&t[i]); fscanf(fp1,"%f",&ver[0]); for(i=0;i<=6;i++) fscanf(fp1,"%d",&t[i]); fscanf(fp1,"%f%f%f",&px[0],&py[0],&pz[0]); fscanf(fp1,"%d%f%d%d",&t[0],&ver[0],&t[1],&t[2]); for(j=1;j<=nodenum-1;j++) { for(i=0;i<=6;i++) fscanf(fp1,"%d",&t[i]); { fscanf(fp1,"%f%f%f",&px[j],&py[j],&pz[j]); fscanf(fp1,"%d%f",&t[0],&ver[0]); } } for(i=1;i<=64;i++) { fscanf(fp3,"%c",&ch); } fscanf(fp3,"%s",val_name); rewind(fp3); for(i=1;i<=111;i++) { fscanf(fp3,"%c",&ch); if(i>=100&&ch=='1'){break;} } printf("Screen or File output(S,F)?"); scanf("%c",&ch); if(ch=='s'||ch=='S') { printf("Continual or Single node output(C,S)?"); scanf("%s",&ch1); if(ch1=='C'||ch1=='c') { printf("\nPlease input Start node:"); scanf("%d",&start); printf("\nPlease input End node:"); scanf("%d",&end); pnode2=node2; for(j=1;j<=nodenum;j++) { fscanf(fp3,"%d",&num_node[3]); for(i=1;i<=6;i++) fscanf(fp3,"%c",&ch); fscanf(fp3,"%f",&pnode[j]); for(i=start;i<=end;i++) { if(i==num_node[3]) {printf("NODE\t X_COOR\t Y_COOR\t Z_COOR\t %s VAL\n",val_name); printf("%d\t %12.6e %12.6e %12.6e %12.6e\n",i,px[j-1],py[j-1],pz[j-1],pnode[j]); } } } printf("Save above datas(Y,N)?"); if(getchar()=='Y'||getchar()=='y') save1(px,py,pz,pnode,val_name); } if(ch1=='s'||ch1=='S') { printf("\nPlease input NODE...(0 for END)\n"); for(i=0;;i++) {scanf("%d",&node2[i]); if(node2[i]==0){m=i;break;} } pnode2=node2; for(j=0;j<=nodenum-1;j++) { fscanf(fp3,"%d",&num_node[3]); for(i=1;i<=6;i++) fscanf(fp3,"%c",&ch); fscanf(fp3,"%f",&pnode[j]); for(i=0;inodenum-1)break; } fclose(fp); } /***********************************************************/ void save2(int number,int pnode2[],float px[],float py[],float pz[],float pnode[],char val_name[]) { FILE *fp; int i; char s1[80]; printf("Please input save filename:"); scanf("%s",s1); if((fp=fopen(s1,"w"))==NULL){ printf("\aFile cannot open!\n"); exit(1); } fprintf(fp,"NODE\t X_COOR\t Y_COOR\t Z_COOR\t %s VAL\n",val_name); for(i=0;i
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: c语言 常用算法源代码
 输入关键字,在本站1000多万海量源码库中尽情搜索: