?? input1.c
字號:
#include "cbox1.h"void Input1(X,Y,Xi,Yi,Code,Bc) float X[102], Y[102],Xi[21],Yi[21],Bc[101]; int Code[101];{ FILE *infile, *outfile; int i,j,k,lnsize; char Title[80],line1[100]; lnsize = 100; /*[ N = number of boundary elements L = number of interior points where the results are computed ]*/ 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); printf("\n"); infile = fopen(inname, "r" ); outfile = fopen(outname,"w" ); fgets(line1,lnsize,infile); fprintf(outfile,"%s \n",line1); fprintf(outfile," Input \n");/*[ Read boundary elements and internal points ]*/ fscanf(infile,"%d %d",&N,&L); fprintf(outfile," \nNumber of Boundary Elements = %2d \n",N); fprintf(outfile,"Number of Interior Points = %2d \n",L);/*[ Read coordinates of extreme points in arrays X and Y ]*/ fprintf(outfile," \nCordinates of Extreme Points \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 the vector Bc[i].]*/ 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 %2d %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 %2.4f %2.4f \n",i,Xi[i],Yi[i]); } } for(i=1;i<=80;i++) fprintf(outfile,"*"); fprintf(outfile," \n"); fclose(infile); fclose(outfile); }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -