二级C程序修改(六),第1张

二级C程序修改(六),第2张

测试说明:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
fun的作用是把数组A中的N
比如当数组A中的值为:1,3,5,7,8
而数组B中的值为:2,3,4,5,8
这个函数调用后,C中存储的数据为:8,15,20,21,16。
main函数和其他函数不要做任何改动,只要在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("bc03.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);
}
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
所需数据:[ 2,3,4,5
6,7,8,9,10
2,3,5,6,7
11,7,2,4,8
8,7,2,3,5
9,日期005
10 18 24 28 30
18 21 30 24 7
55 21 4 28 64
72 60 12 44 56
36 30 8 36 21
# E

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 二级C程序修改(六)

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情