#include<stdio.h>
#define MAXSIZE 10000
typedef struct{
int i,j;
int e;
}Triple;
typedef struct{
Triple data[MAXSIZE+1];
int mu,nu,tu;
}TSMatrix;
int row,col;
TSMatrix *CreateSMatrix(TSMatrix *M)
{
int m,n,p=1;
int c;
printf("please input array A:\n ");
for(m=1;m<=row;m++)
for(n=1;n<=col;n++)
{
scanf("%d",&c);
if(c!=0)
{
M->data[p].e=c;
M->data[p].i=m;
M->data[p].j=n;
p++;
}
}
M->tu=p;M->mu=row;M->nu=col;
printf("the old TSMatrix is:\n\n");
for(m=1;m<=M->tu;m++)
printf("%3d %3d %3d\n",M->data[m].i,M