【发布时间】:2023-03-06 21:00:01
【问题描述】:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define ROWS 2
#define COLS 3
#define ROW 3
#define COL 4
int main(void)
{
int e, f;
srand((unsigned)time(NULL));
int A[ROWS][COLS];
int a; int b;
for (a = 0; a < ROWS; ++a)
{
for (b = 0; b < COLS; ++b)
{
printf("%d ", A[a][b] = rand() % 9 + 1);
}
printf("\n");
}
printf("-------------------------\n");
int B[ROW][COL];
int c; int d;
for (c = 0; c < ROW; ++c)
{
for (d = 0; d < COL; ++d)
{
printf("%d ", B[c][d] = rand() % 9 + 1);
}
printf("\n");
}
return 0;
}
此代码使用 rand 函数。制作二维数组。 [int A,int B]
我想在二维数组中使用随机值进行乘法运算。
我想制作另一个二维数组。和 int A * int B 前任) int C= int A*int B (二维数组)
【问题讨论】: