是将没一行是最大值与第0个值交换
并将主函数新二维数组按二维形式输出到文件myf.out中
# include <stdio.h>
main()
{
int a[3][4]={{4,6,3,5},{9,7,3,2},{6,8,1,5}};
FILE*fp;int i,j;
if ((fp=fopen("myf.out","read"))==NULL)这而好象没错,但能否调的出?
{printf("Can't open file .\n");exit(0);}
fun( int a[3][4]);这儿定义有什么错误
for (i=0;i<3;i++)
{for (j=0;j<4;j++)
fput(a[i][j],fp);
fput(\n,fp);}每输4个换一行怎么办?此处有错
fclose(fp);
}
fun(int a[][4])
{
int i,j,t,n;
for (i=0;i<3;i++)
{for (j=1;j<4;j++)
{ t=0;
if(a[i][t]<a[i][j])t=j;}
n=a[i][0];a[i][0]=a[i][t];a[i][t]=n; }
}
并将主函数新二维数组按二维形式输出到文件myf.out中
# include <stdio.h>
main()
{
int a[3][4]={{4,6,3,5},{9,7,3,2},{6,8,1,5}};
FILE*fp;int i,j;
if ((fp=fopen("myf.out","read"))==NULL)这而好象没错,但能否调的出?
{printf("Can't open file .\n");exit(0);}
fun( int a[3][4]);这儿定义有什么错误
for (i=0;i<3;i++)
{for (j=0;j<4;j++)
fput(a[i][j],fp);
fput(\n,fp);}每输4个换一行怎么办?此处有错
fclose(fp);
}
fun(int a[][4])
{
int i,j,t,n;
for (i=0;i<3;i++)
{for (j=1;j<4;j++)
{ t=0;
if(a[i][t]<a[i][j])t=j;}
n=a[i][0];a[i][0]=a[i][t];a[i][t]=n; }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货