二维数组练习题_讨论帖

黛琳ghz
2022年度博客之星前端领域TOP 8
博客专家认证
2022-12-07 15:05:16

基于二维数组实现矩阵转置,以下选项对应(1)处缺失的代码,请判断哪一项无法实现矩阵转置。

for (i = 1; i <= row; ++i)
for (j = 1; j <= col; ++j)
((t + j) + i) = ((m + i) + j);

#include <stdio.h>
#define LEN 101

void print_matrix(int mat[][LEN], int row, int col)
{
    for (int i = 0; i < row; ++i)
    {
        for (int j = 0; j < col; ++j)
            printf("%d\t", mat[i][j]);
        printf("\n");
    }
}

int main(int argc, char** argv)
{
    int i, j, row, col, num, m[LEN][LEN], t[LEN][LEN];

    printf("请输入矩阵的行数(<=100):");
    scanf("%d", &row);
    printf("请输入矩阵的列数(<=100):");
    scanf("%d", &col);
    num = row * col;
    printf("请输入矩阵的元素(共%d个,空格分隔):\n", num);
    for (i = 0; i < row; ++i)
        for (j = 0; j < col; ++j)
            scanf("%d", &m[i][j]);

    printf("转置前:\n");
    print_matrix(m, row, col);

    (_____1_____)

    printf("转置后:\n");
    print_matrix(t, col, row);

    return 0;
}

...全文
170 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
二维数组习题讲解,可以改编,谢谢惠顾!谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢!

8

社区成员

发帖
与我相关
我的任务
社区管理员
  • community_1185
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧