排序算法功能函数 Compositor.cpp

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

///////////////////////////

// //

// 排序算法功能函数 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();

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航