求助文件的输入输出
file1,file2应放在那里#include<stdio.h>
#define M 30
void sort(int *x,int n);
main(){
int j,n,t,x[M];
FILE *old,*new;
old=fopen("file1","r");
n=0;
while(!feof(old)){
fscanf(old,"%d",&t);
x[n++]=t;
}
fclose(old);
sort(x,n);
new=fopen("file2","w");
for(j=0;j<n;j++)
fprintf(new,"%8d",x[j]);
fclose(new);
}
void sort(int *x,int *n){
int i,j,k,t;
for(j=i;j<n;j++){
k=i;
for(j=i;j<n;i++)
if(*(x+j)<*(x+k))k=j;
if(k!=k){
t=*(x+i);*(x+i)+*(x+k);*(x+k)=t;
}
}
}