代码
#include <iostream>
#include <stdlib.h>
using namespace std;
//定义链表中的结点
typedef struct OLNode{
int i,j,e;
struct OLNode *right,*down;
}OLNode,*OLink;
typedef struct{
OLink *rhead,*chead;//行和列链表头指针
int mu,nu,tu; //矩阵的行数,列数和非零元个数
}CrossList;
CrossList CreateMatrix_OL(CrossList M);//创建十字链表
void display(CrossList M);//输出十字链表
int main(){
CrossList M;
M.rhead=NULL;
M.chead=NULL;
M=CreateMatrix_OL(M);
printf("输出矩阵:\n");
display(M);
return 0;
}
CrossList CreateMatrix_OL(CrossList M){
int m,n,t;//行数,列数,非零元个数
int i,j,e;
OLNode *p,*q;
printf(