?? input2.c
字號(hào):
#include "cbox2.h"void Input2(Xi,Yi,X,Y,Code,Bc) float Xi[21],Yi[21],X[82],Y[82],Bc[161]; int Code[161];{ FILE *infile, *outfile; int i,j,k,lnsize; char Title[80],line1[100]; lnsize = 100; printf("\nNOTE: FIRST LINE IN THE INPUT FILE SHOULD BE EITHER BLANK OR THE TITLE NOT 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); infile = fopen(inname, "r" ); outfile = fopen(outname,"w" ); fgets(line1,lnsize,infile); fprintf(outfile,"%s \n",line1); fprintf(outfile,"Input \n"); fscanf(infile,"%d %d",&N,&L); fprintf(outfile," \nNumber of Boundary Elements = %d \n",N); fprintf(outfile," \nNumber of InteriorPoints = %d \n",L); fprintf(outfile," \nCoordinates of the Extreme Points"); fprintf(outfile," of the Boundary Elements \n \n"); fprintf(outfile,"Point 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]); } /*[ Read boundary conditions in Bc[] vector. If Code[i] = 0, the Bc value is a known potential; if Code[i] = 1, the Bc[] value is a known potential derivative (flux). Two Boundary conditions are read per element. One node may have two values of the potential derivative but only one vlue of the potential ]*/ fprintf(outfile," \nBoundary Conditions \n\n"); fprintf(outfile," First Node Second Node\n"); fprintf(outfile," Prescribed Prescribed\n"); fprintf(outfile,"Element CODE Value CODE Value\n"); for(i=1;i<=N;i++) { fscanf(infile,"%d %f %d %f",&Code[2*i -1],&Bc[2*i -1], &Code[2*i],&Bc[2*i]); fprintf(outfile,"%2d\t\t\t%2d %10.4f\t\t\t%2d %10.4f\n", i,Code[2*i -1],Bc[2*i -1],Code[2*i],Bc[2*i]); } /*[ Read coordinates of the interior points ]*/ fprintf(outfile,"\nInterior Point Coordinates\n\n"); fprintf(outfile," Xi Yi\n"); for(i=1;i<=L;i++) { fscanf(infile,"%f %f \n",&Xi[i],&Yi[i]); fprintf(outfile," %10.4f %10.4f\n",Xi[i],Yi[i]); } fclose(infile); fclose(outfile); }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -