国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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ǔ)(青島大學-王卓)緒論的評論 (共 條)

分享到微博請遵守國家法律
明光市| 晴隆县| 新和县| 贡觉县| 佛坪县| 乐至县| 淮阳县| 东莞市| 新昌县| 和平区| 黄陵县| 濮阳市| 黄骅市| 荥经县| 嵊州市| 冷水江市| 富裕县| 黄骅市| 修水县| 东乌珠穆沁旗| 天津市| 靖宇县| 吉首市| 迁安市| 洪湖市| 黄龙县| 千阳县| 明水县| 松潘县| 邢台市| 龙南县| 潞西市| 介休市| 肥东县| 高要市| 永善县| 手游| 宜兴市| 江永县| 年辖:市辖区| 老河口市|