📄 pchain.cpp
字号:
// test linked rank sort
#include <iostream.h>
#include "pchain.h"
void main(void)
{
try {
Chain<int> C, D, E, F, G;
// try a sorted chain
C.Insert(0,2).Insert(1,6).Insert(2,7).Insert(3,8).Insert(4,9);
cout << "Chain is " << C << endl;
C.RankSort();
cout << "The sorted chain is " << C << endl;
// try a decreasing chain
D.Insert(0,5).Insert(1,4).Insert(2,3).Insert(3,2).Insert(4,1);
cout << "Chain is " << D << endl;
D.RankSort();
cout << "The sorted chain is " << D << endl;
// try a random chain
E.Insert(0,5).Insert(1,8).Insert(2,6).Insert(3,7);
E.Insert(4,1).Insert(2,3).Insert(0,9).Insert(0,4);
cout << "Chain is " << E << endl;
E.RankSort();
cout << "The sorted chain is " << E << endl;
// try an empty chain
cout << "Chain is " << F << endl;
F.RankSort();
cout << "The sorted chain is " << F << endl;
// try a chain with one element
G.Insert(0,1);
cout << "Chain is " << G << endl;
G.RankSort();
cout << "The sorted chain is " << G << endl;
}
catch (...) {
cerr << "An exception has occurred" << endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -