|
|
排序算法功能函数 Compositor.cpp |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
/////////////////////////// // // // 排序算法功能函数 Compositor.cpp // // // //////////////////////////
#include"Compositor.h"
const int INT =13; const double FLOAT= 13.33; const char CHAR ='a';
template<class type> void CompositorINI(type temp) { Compositor<type> CompositorOPP;
do { cout<<"排序的操作: "<<endl <<" 1) 插入排序"<<endl <<" 2) 快速排序"<<endl <<" 3) 归并排序"<<endl <<" 4) 冒泡排序"<<endl <<" 5) 选择排序"<<endl <<" X) 退出排序操作"<<endl <<"请选择相应的操作: "; int item; cin>>item; switch(item) { case 1: Compositor_Insert(CompositorOPP); break; case 2: Compositor_Quick(CompositorOPP); break; case 3: Compositor_Merge(CompositorOPP); break; case 4: Compositor_Bubble(CompositorOPP); break; case 5: Compositor_Select(CompositorOPP); break;
default: return ; }
}while(true);
}
void COMPOSITOR()//根据不同的用户需要选择数据类型 { int item; cout<<"清选择数据类型: 1) 整型 2) 浮点型 3) 字符型 X) 退出: ";
cin>>item; switch(item) { case 1: CompositorINI(INT); break; case 2: CompositorINI(FLOAT); break; case 3: CompositorINI(CHAR); break; default: return ; break; } }
template<class type> void Compositor_Insert(Compositor<type> CompositorOPP) { CompositorOPP.Insert(); }
template<class type> void Compositor_Quick(Compositor<type> CompositorOPP) { CompositorOPP.Quick(); }
template<class type> void Compositor_Select(Compositor<type> CompositorOPP) { CompositorOPP.Select(); }
template<class type> void Compositor_Merge(Compositor<type> CompositorOPP) { CompositorOPP.MergeSort(); }
template<class type> void Compositor_Bubble(Compositor<type> CompositorOPP) { CompositorOPP.Bubble(); }

|
|
相关文章:相关软件: |
|