慕码人8056858
#include <stdio.h>void write(){int i;int a[10];FILE *file;file=fopen("file.out","wb");printf("input 10 integer numbers\n");for(i=0;i<10;i++){scanf("%d",&a[i]);fwrite(&a[i],sizeof(int),1,file);}fclose(file);}void read(){FILE *file;int a[10];int i,j;int temp;file=fopen("file.txt","rb");for(i=0;i<10;i++){fread(&a[i],sizeof(int),1,file);}fclose(file);for(i=0;i<10;i++){for(j=i+1;j<10;j++){if(a[i]>a[j]){temp=a[i];a[i]=a[j];a[j]=temp;}}}file=fopen("file1.txt","wt");for(i=0;i<10;i++){fprintf(file,"%d ",a[i]);}fclose(file);}int main(){write();read();return 0;}