求一个5*5的整形矩阵中各行元素及各列元素之和

♐️遵義哥哥 2024-05-14 16:43:58
最佳回答
long getsum(int array[][]) //返回总和{ long total = 0; if (array == **) return -1; for(int i = 0; i < 5; i++) for(int j = 0; j < 5; j++) total += array[i][j]; return total;} long getrowsum(int array[][], int row) //返回某行的总和{ long total = 0; if (row < 1 || row > 5 || array == **) //行号位于[1,5] return -1; for(int i = 0; i < 5; i++) total += array[row - 1][i]; return total;} long getlinesum(int array[][], int line) //返回某列的总和{ long total = 0; if (line < 1 || line > 5 || array == **) //列号位于[1,5] return -1; for(int i = 0; i < 5; i++) total += array[i][line - 1]; return total;} 20210311
汇率兑换计算器

类似问答
汇率兑换计算器

热门推荐
热门问答
最新问答
推荐问答
新手帮助
常见问题
房贷计算器-九子财经 | 备案号: 桂ICP备19010581号-1 商务联系 企鹅:2790-680461

特别声明:本网为公益网站,人人都可发布,所有内容为会员自行上传发布",本站不承担任何法律责任,如内容有该作者著作权或违规内容,请联系我们清空删除。