📄 main.cpp
字号:
#include <iostream.h>
#include "CrossList.h"
void main()
{
int testArray[4][4]={{0,0,0,0},{0,1,0,0},{1,1,0,0},{1,0,0,1}};
CrossList a;
a.CreateCrossList(4,4,testArray);
cout<<"0 0 0 0\n"
<<"0 1 0 0\n"
<<"1 1 0 0\n"
<<"1 0 0 1\n"<<endl;
cout<<" 测试链表: \n";
cout<<endl<<"链表中非零元素个数为 :"<<a.GetDataNum()<<endl;
cout<<"--------------------------------------------------------"<<endl;
cout<<"对链表中任意元素进行操作:\n";
OLNode *t=a.GetOLNode(1,1);
cout<<"t->row: "<<t->row<<" ";
cout<<"t->column: "<<t->column<<" ";
cout<<"t->data: "<<t->data<<endl;
t=a.GetOLNode(2,1);
cout<<"t->row: "<<t->row<<" ";
cout<<"t->column: "<<t->column<<" ";
cout<<"t->data: "<<t->data<<endl;
/*t=a.GetOLNode(0,0);
cout<<"t->row: "<<t->row<<" ";
cout<<"t->column: "<<t->column<<" ";
cout<<"t->data: "<<t->data<<endl;*/
cout<<"--------------------------------------------------------"<<endl;
cout<<"打印链表:\n";
a.Print();
cout<<"--------------------------------------------------------"<<endl;
cout<<"分别在空链,链首,链中,链尾插入元素:\n";
cout<<"在链首中插入:\n";
a.InsertNode(0,0,1);
a.InsertNode(1,0,1);
a.InsertNode(2,2,1);
a.InsertNode(3,2,1);
a.Print();
cout<<"--------------------------------------------------------"<<endl;
cout<<"析构链表: \n";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -