二级C程序修改(八)
测试描述:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
fun的作用就是把数组A中的N
比如当数组A中的值为:1,3,5,7,8
而数组B中的值为:2,3,4,5, 8
这个函数被调用后,数组C中存储的数据是9,8,9,10,10
不要改变主函数和其他函数中的任何东西,只需在fun函数的花括号中填入你所写的一些语句
。
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
程序:
= = = =
}
main()
{ int i,a[100]={1,3,5,7,8},b[100]={2,3,4,5,8},c[100];
clrscr();
fun(a,b,c,5);
printf("结果是:");
for(I = 0;iprintf(" \ n ");
NONO();
}
O ()
{/*该函数用于打开文件、输入数据、调用函数、输出数据和关闭文件。*/
FILE *rf,* wf
int a[100],b[100],c[100],I,j;
rf = fopen("in.dat "," r ");
wf = fopen("bc01.dat "," w ");
for(I = 0;I < 5;I){
for(j = 0;j < 5;j ) fscanf(rf," %d,",& a[j]);
for(j = 0;j < 5;j ) fscanf(rf," %d,",& b[j]);
fun(a,b,c,5);
for(j = 0;j < 5;j ) fprintf(wf," %d ",c[j]);
fprintf(wf," \ n ");
}
f close(RF);
fclose(wf);
}
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
0条评论