📄 input5.c
字号:
#include "cbox5.h"void Input5(Xi,Yi,X,Y,Code,Bc) float Xi[21],Yi[21],X[102],Y[102],Bc[101]; int Code[101]; { FILE *infile, *outfile; int i,j,k,lnsize; char title[80],line1[100]; lnsize = 100; printf("\nNOTE:FIRST LINE IN INPUT FILE SHOULD BE THE TITLE OR LEFT BLANK NO DATA\n"); printf("\n Enter the name of the input file:"); scanf("%s", inname); printf("\n Enter the name of the output file:"); scanf("%s", outname); printf("\n"); infile = fopen(inname, "r" ); outfile = fopen(outname,"w" ); fgets(line1,lnsize,infile); fprintf(outfile,"%s\nInput \n",line1); fscanf(infile,"%d %d %d",&N,&L,&M); fprintf(outfile," \nNumber of Boundary Elements = %d \n",N); fprintf(outfile,"Number of Interior Points = %d \n",L); if(M > 0) { fprintf(outfile,"Number of different Boundaries = %d \n \n",M); for(i=1;i<=M;i++) { fscanf(infile,"%d",&Last[i]); fprintf(outfile,"Last node on boundary %2d = %2d \n",i,Last[i]); } } fprintf(outfile," \nCordinates of The Extreme"); fprintf(outfile," Points of the Boundary Elements \n"); fprintf(outfile,"\nPoint X Y \n"); for(i=1;i<=N;i++) { fscanf(infile,"%f %f",&X[i],&Y[i]); fprintf(outfile,"%2d %10.4f %10.4f \n",i,X[i],Y[i]); } fprintf(outfile," \n \n"); /*[ Read boundary conditions in Bc[i] vector; if Code[i] = 0, the Bc[i] value is a known potential; if Code[i] = 1, the Bc[i] value is a known potential derivative (flux).]*/ fprintf(outfile,"Boundary Conditions \n"); fprintf(outfile,"\nNode Code Prescribed Value \n"); for(i=1;i<=N;i++) { fscanf(infile,"%d %f",&Code[i],&Bc[i]); fprintf(outfile,"%2d \t\t\t%2d \t\t\t%10.4f \n",i,Code[i],Bc[i]); } fprintf(outfile," \n \n");/*[ Read coordinates of the interior points ]*/ if( L) { fprintf(outfile," \nInterior Point Coordinates \n"); fprintf(outfile,"\nPoint Xi Yi\n"); for(i=1;i<=L;i++) { fscanf(infile,"%f %f",&Xi[i],&Yi[i]); fprintf(outfile,"%2d %10.4f %10.4f\n",i,Xi[i],Yi[i]); } } for(i=1;i<=80;i++) fprintf(outfile,"*"); fprintf(outfile," \n"); fclose(infile); fclose(outfile); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -