下载此文档

C压缩矩阵相加.doc


文档分类:IT计算机 | 页数:约4页 举报非法文档有奖
1/4
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/4 下载此文档
文档列表 文档介绍
C压缩矩阵相加
#include<>
#include<>
#define maxsize 1000//定义非零元的最大数目 typedef struct //定义一个三元组 {
int i, j; //非零元行号、列号
int v; //非零元的值
}Triple;
typedef struct //定义稀疏矩阵
{
Triple data[maxsize]; //三元组表
int m, n, t; //稀疏矩阵行、列数、非零元个数
}TSMatrix;
int main()
{
printf("-------------------Matrix's addition!\n");
TSMatrix M,N;
int flag,a,b;
static int sum[100][100]={0};
=0;
=0;
printf("Input the first Matrix's column and line:");
scanf("%d,%d",&,&);
printf("Input the first Matrix'number:\n");
for(a=0;a<;a++)
{
for(b=0;b<;b++)
{
scanf("%d",&flag);
if(flag!=0)
{
[].i=a;
[].j=b;
[].v=flag;
++;
}
}
}
printf("\n");
printf("Input the second Matrix's column and line:");
scanf("%d,%d",&,&);
printf("Input the second Matrix'number:\n");
for(a=0;a<;a++)
{
for(b=0;b<;b++)
{
scanf("%d",&flag);
if(flag!=0)
{
[].i=a;
[].j=b;
N.

C压缩矩阵相加 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数4
  • 收藏数0 收藏
  • 顶次数0
  • 上传人Gebu
  • 文件大小15 KB
  • 时间2021-11-07
最近更新