二级C程序设计(二),第1张

二级C程序设计(二),第2张

测试说明:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
fun的作用是把数组A中的N
举例:
如果数组A中的值是:1,3,5,7,8
数组B中的值是:2,3,4,5,8
调用这个函数后,C中存储的数据是81,64,81,81。
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("bc04.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
121 121 121 121 121 121 121 121 121 121 64
256 100 16 121 256
289 256 49 225 225
169 169 81 169 169 100
# E

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

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情