Delete '步骤七.cpp'

main
pecp45i32 3 days ago
parent 95a41a499f
commit bdac6cf3e4

@ -1,45 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 100
void matmul(float A[SIZE][SIZE], float B[SIZE][SIZE], float C[SIZE][SIZE], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
float sum = 0.0f;
for (int k = 0; k < n; k++) {
sum += A[i][k] * B[k][j];
}
C[i][j] = sum;
}
}
}
int main() {
float A[SIZE][SIZE], B[SIZE][SIZE], C[SIZE][SIZE];
srand(time(NULL));
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
A[i][j] = rand() % 101;
B[i][j] = rand() % 101;
C[i][j] = 0;
}
}
matmul(A, B, C, SIZE);
printf("Result matrix C (partial):\n");
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
printf("%.2f ", C[i][j]);
}
printf("\n");
}
return 0;
}
Loading…
Cancel
Save