五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

矩陣乘法 的C程序?qū)崿F(xiàn)2(利用數(shù)組指針)——數(shù)據(jù)結(jié)構(gòu)與算法基礎(chǔ)(青島大學-王卓)緒論

2023-02-22 06:41 作者:阿勇往直前  | 我要投稿

#include<stdio.h>
#include<stdlib.h>

#define N 3
void initMatrix(int(*)[N], int, int);
void mulMatrix(int(*)[N], int(*)[N], int(*)[N], int);
void showMatrix(int(*)[N], int );


int main()
{

?? ?int a[N][N];
?? ?int b[N][N];
?? ?int c[N][N];

?? ?initMatrix(a, N, 1);
?? ?initMatrix(b, N, 5);
?? ?mulMatrix(c, a, b, N);
?? ?showMatrix(a, N);
?? ?showMatrix(b, N);
?? ?showMatrix(c, N);

?? ?system("pause");
?? ?return 0;
}

void initMatrix(int (*a)[N], int n, int starti)
{
?? ?for (int i = 0; i < n; i++)
?? ?{
?? ??? ?for (int j = 0; j < n; j++)
?? ??? ?{
?? ??? ??? ?a[i][j] = starti + i + j;
?? ??? ?}
?? ?}
}

void mulMatrix(int (*c)[N], int (*a)[N], int (*b)[N], int n)
{
?? ?for (int i = 0; i < n; i++)
?? ?{
?? ??? ?for (int j = 0; j < n; j++)
?? ??? ?{
?? ??? ??? ?c[i][j] = 0;
?? ??? ??? ?for (int k = 0; k < n; k++)
?? ??? ??? ?{
?? ??? ??? ??? ?c[i][j] = c[i][j] + a[i][k] * b[k][j];
?? ??? ??? ?}

?? ??? ?}
?? ?}
}

void showMatrix(int (*a)[N], int n)
{
?? ?for (int i = 0; i < n; i++)
?? ?{
?? ??? ?for (int j = 0; j < n; j++)
?? ??? ?{
?? ??? ??? ?printf("%d\t", a[i][j]);
?? ??? ?}
?? ??? ?printf("\n");
?? ?}
?? ?printf("\n");
}

矩陣乘法 的C程序?qū)崿F(xiàn)2(利用數(shù)組指針)——數(shù)據(jù)結(jié)構(gòu)與算法基礎(chǔ)(青島大學-王卓)緒論的評論 (共 條)

分享到微博請遵守國家法律
徐闻县| 奉贤区| 邵阳县| 大埔区| 衡阳市| 榆树市| 丁青县| 安塞县| 庆城县| 平遥县| 武平县| 宁阳县| 原阳县| 郧西县| 龙陵县| 鹤岗市| 巧家县| 镇康县| 宿州市| 绥棱县| 武强县| 西宁市| 襄樊市| 天等县| 枝江市| 建宁县| 宁波市| 忻城县| 澳门| 万载县| 高雄县| 泌阳县| 项城市| 定远县| 巴林左旗| 合川市| 孟连| 富源县| 宿迁市| 怀远县| 嘉定区|