我正在使用 scanf() 函数将矩阵分配给变量,但我想从文本文件中调用矩阵。
这是我的代码:
int rows;
int columns;
float weight;
float step;
printf("Enter the number of rows and columns of the matrix.\n");
scanf("%d%d", &rows,&columns);
printf("Enter step for the weight.\n");
scanf("%f", &step);
int a[rows][columns], b[rows][columns],i,j;
float c[rows][columns];
printf("Enter the First matrix->");
for(i=0;i<rows;i++)
for(j=0;j<columns;j++)
scanf("%d",&a[i][j]);
printf("\nEnter the Second matrix->");
for(i=0;i<rows;i++)
for(j=0;j<columns;j++)
scanf("%d",&b[i][j]);