//【例9.5】在【例6.10】中未能重载插入运算符"<<",本例给予改进。 #include using namespace std; template struct Node{ T key; // 其他域省略 };//再次指出分号不可少 template class Orderedlist{ int maxsize; int last; Node slist[size]; public: Orderedlist(){last=-1;maxsize=size;} void BubbleSort(); bool Insert(Node & elem,int i); void print(); // 无关成员函数省略 };//再次指出分号不可少 template bool Orderedlist::Insert(Node & elem ,int i){ if (i<0||i>last+1||last==maxsize-1) return false; else{ for (int j=last;j>i;j--) slist[j]=slist[j-1]; slist[i]=elem; last++; return true; } } template void Orderedlist::print(){ int i; for(i=0;i<=last;i++){ cout< void Orderedlist::BubbleSort(){ bool noswap; int i,j; Node temp; for (i=0;ii;j--){//从下往上冒泡 if(slist[j].key ordlist; char mslist[h][5]={"cat","book","car","zoo","fish","cab","dog","cap","fox","can"}; Node n[h];//定义结点数组 for(i=0;i