#include<stdio.h>#define N 10void main(){ int a[N],i,j,k; FILE *fp; for ( i=0;i<N;i++ ) scanf("%d",&a[i]); for ( i=0;i<N-1;i++ ) for ( j=i+1;j<N;j++ ) if ( a[i]<a[j] ) { k=a[i];a[i]=a[j];a[j]=k; } if ( fp=fopen("c:\\data.txt","w+") ) { for ( i=0;i<N;i++ ) fprintf(fp,"%d\n",a[i]); fclose(fp); } else printf("创建文件错误。\n");}