鱼C论坛

 找回密码
 立即注册
查看: 2613|回复: 1

数组行列这么从键盘输入规定

[复制链接]
发表于 2019-11-26 15:41:02 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
数组的行列这么从键盘输入规定
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2019-11-26 23:32:01 | 显示全部楼层
  1. #include <stdio.h>
  2. int main(int argc, char const *argv[])
  3. {
  4.     int row = 0, col = 0;
  5.     scanf("%d%d", &row, &col);
  6.     int arr[row][col];
  7.     for(size_t i = 0; i < row; i++)
  8.     {
  9.         for(size_t j = 0; j < col; j++ )
  10.         {
  11.             scanf("%d", &arr[i][j]);
  12.         }
  13.     }
  14.     for(size_t i = 0; i < row; i++)
  15.     {
  16.         for(size_t j = 0; j < col; j++ )
  17.         {
  18.             printf("%d", arr[i][j]);
  19.         }
  20.         printf("\n");
  21.     }
  22.     return 0;
  23. }
复制代码

--------------------------------------------------------------
Microsoft Windows [版本 10.0.18363.476]
(c) 2019 Microsoft Corporation。保留所有权利。

E:\Users\admin\Documents\VScode\Code>c:\Users\admin\.vscode\extensions\ms-vscode.cpptools-0.26.1\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-wcq3otkr.tin --stdout=Microsoft-MIEngine-Out-fymelq3q.ald --stderr=Microsoft-MIEngine-Error-mxsmydpf.4a5 --pid=Microsoft-MIEngine-Pid-4gucyoxt.lgj --dbgExe=D:\MinGW\bin\gdb.exe --interpreter=mi
3 3
1
2
3
4
5
6
7
8
9
123
456
789
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-23 21:49

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表