编程数组(Programming array).doc

  1. 1、本文档共29页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
编程数组(Programming array)

编程数组(Programming array) Two, array problems: 37 find a 2 * M integer two-dimensional array of the value of the largest element, and return this value to call the function. Fun (int, a[][M]) {int, I, J, max=a[0][0]; For (i=0; i2; i++) For (j=0; jM; j++) If (maxa[i][j]) max=a[i][j]; Return max;} 38 find a 4 * M integer two-dimensional array of the minimum element value, and return this value to call the function. Fun (int, a[][M]) {int, I, J, min=a[0][0]; For (i=0; i4; i++) For (j=0; jM; j++) If (mina[i][j]) min=a[i][j]; Return min;} 39 find the largest element of each column in the two-dimensional array, and then put it in the one-dimensional array of the PP Void fun (int, tt[M][N], int, pp[N]) {int, I, J, max; For (j=0; jN; j++) {max=tt[0][j]; For (i=0; iM; i++) If (tt[i][j]max) max=tt[i][j]; Pp[j]=max;}} The 40 program defines a N * N two-dimensional array and sets 0 values to the surrounding elements of the array. Fun (int, w[][N]) {int, I, j; For (i=0; iN; i++) For (j=0; jN; j++) If (i==0||i==N-1||j==0||j==N-1) W[i][j]=0;} The 41 program defines a N * N two-dimensional array, so that the value in the first row element of the array is reversed with the value in the first row element, and the value in the second row element is reversed from the value in the last second elements,...... And others in turn. For example, the value in the a array is 0111279 19745145682 1591741 After you return the main program, the value in the a array should be 1591741 14568219745 0111279 Int fun (int a[][N]) {int, I, J, k; For (i=0; iN/2; i++) For (j=0; jN; j++) {k=a[i][j]; a[i][j]=a[N-i-1][j]; A[N-i-1][j]=k;}} The 42 program defines a N * N two-dimensional array, so that the values in the first column element of the array are swapped with the values in the last column element, and the values in the second column elements are swapped with the values in the last second column elements,...... And others in turn. For example, the value in the a array is 0111279 19745

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档