Advertisement
Kojima0502

minimum

Jan 23rd, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5.    
  6.    
  7.     float i=0;
  8.     float x[10];
  9.     FILE *fpi,*fpo;
  10.     if(argc!=3)
  11.    
  12.    
  13.    
  14.     if(argc!=2)
  15.     {
  16.         fprintf(stderr,"Usage: %s (1)CSV1File\n(2)CSV2File\n(3)VTKFile\n",argv[0]);
  17.        
  18.         return 0;
  19.     }
  20.    
  21.     printf("Open CSV1 File\n");
  22.    
  23.     if((fpi=fopen(argv[1],"r"))==NULL)
  24.     {
  25.         printf("The file can't be opened. The program is exit.\n");
  26.        
  27.         return 0;
  28.     }
  29.  
  30.     if((fpo=fopen(argv[2],"w"))==NULL)
  31.      {
  32.      printf("The file can't be opened. The program is exit.\n");
  33.      
  34.      return 0;
  35.      }
  36.    
  37.     while (fscanf(fpi," %f %f %f %f %f %f %f %f %f %f",x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9])!= EOF)
  38.     {
  39.        
  40.     }
  41.    
  42.     float min(float *x[])
  43.     {
  44.         float min=x[0];
  45.         for(float i=1;i<i+1;++i){
  46.             if(x[0]>x[i]){
  47.                 min=x[i];
  48.             }
  49.         }  
  50.  
  51.     printf("minimum=%f\n",min);
  52.    
  53.     fclose(fpi);
  54.     fclose(fpo);
  55.    
  56.    
  57.    
  58.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement