邻接矩阵可旋转矩阵# include ‘ stdio.h ‘ # define row4# define col4inta [ row ] [ col ]={0}; //相邻矩阵int P[ROW][COL]={ 0 }; //可达矩阵int tmp[ROW][COL]={ 0 }; //临时存储数据的矩阵int plus[ROW][COL]={ 0 }; //保存矩阵相加后的结果voidinitainta[row][col] ) {int flag=1,temp; 请输入printf ‘有向图相邻矩阵中的数据范围0,1,2 ) :n ) ); forintI=0; i ROW; I ) forintj=0; j COL; j ) ) {flag=1; whileflag ) ) printf’%d行%d列”,i 1,j 1 ); scanf’%d ‘,temp ); if 时间!=0 temp!=1 temp!=2)请重新输入printf ‘ 0,1,2 n )的数字; }else{A[i][j]=temp; flag=0; }}}}voidshowintarr[row][col] ) {printf ) 输出矩阵:n ) ); forintI=0; i ROW; I ) forintj=0; j COL; j ) printf’%d ‘,arr[i][j]; }printfn ); }voidmultintrow,int col,int rank )//首先tmpfor的元素) intI=0; i row; I ) forintj=0; j col; j{tmp[I][j]=a[I][j] ); //首先将a的元素代入plus for inti=0; i row; I ) forintj=0; j col; j{plus[I][j]=a[I][j] ); }forintr=1; r rank; r ) /矩阵乘法for ) intI=0; i row; I ) forintj=0; j col; j{tmp[I][j]=tmp[I][j]*a[j][I] ); //矩阵加法运算forintI=0; i ROW; I ) forintj=0; j COL; j { plus [ I ] [ j ]=plus [ I ] [ j ] tmp [ I ] [ j ] ); }}}}int main ) inita ) ) a; showa ); //打印数组中的元素mult row、COL、4-1 ); //矩阵乘法showplus; forintI=0; i ROW; I ) forintj=0; j COL; j ) if ) plus[I][j]!=0) {plus[i][j]=1; if ) I==j ) ) {plus[i][j]=1; }}}printf 可达矩阵为n ) ); showplus; 返回0; }
相关文章
用哪个弄湿
2026年6月24日少儿国寿福庆典版优缺点在哪?不足和亮点各参半
2026年6月24日狗狗吃卫生巾怎么办
2026年6月24日房贷二次扣款会影响征信吗?这是很有可能的
2026年6月24日身份证过期坐火车怎么办
2026年6月24日农行房贷还款日几点扣款?这些事项要注意
2026年6月24日
评论
站内搜索
热门文章
友情链接
- 科技博客
- 文本分割器
- 房贷计算器
- 存款利率计算器
- 反应速度测试
- 舒尔特方格
- mx记录查询
- 尺子在线测量
- 国旗图片大全
- 贷款计算器
- 日期计算器
- 孕周计算器
- 在线秒表
- Favicon Generator
- 超小厨美食
- Morse Code Translator
- national flag
- email tools
- market hours
- regex generator
- 科技博客
- 娱乐八卦
- free image compressor
- how to delete
- just delete me
- play piano
- 风君网络
- easy piano songs
- symbol
- online counter
- wiztree
- wiztree download
- online scoreboard
- 7zip download
- sharex download
- bandizip
- password remover
- bitumen calculator
- Asphalt Calculator
- random pokemon generator
- vlc播放器
- Electricity Bill Calculator
- Elven Name Generator
- Car logos
- stadium view
- voidimageviewer
- space bar clicker
- starbucks nutrition calculator
- cooking calculator
- Country Drawing
- World TV channels
发表回复