C++编程编写一个冒泡排序的函数模板，并用它分别对int型和字符 ,简单的描述是编写一个冒泡排序的模板，并用它分别对int型和字符数据进行排序,答案是#include <tream>#include <string>/*这是一个起泡排序的模板输入：data 待排序数组 ，      size 数组大小输出：排序后数组其他说明：      数据类型T应支持 < 和 =       10/6/2006  coded by YunDanFengQing */template < class T >void BubbleSort ( T * data, int size ) {    bool swapped = false;    T temp;    do {        swapped = false;        for ( int i = 0; i < size-1; i++ ) {            if ( data[ i+1 ] < data[ i ] ) {                temp = data[ i+1 ];                data[ i+1 ] = data [ i ];                data[ i ] = temp;                swapped = true;            }        }    }while ( true == swapped );      }// BubbleSortint main(){    int i = 0;    int a[10] = { 2, 4, 6, 5, 7, 9, 1, 3,8 };    std::string s[11] = { "aaaa", "aaba", "abcd", "bcded", "aaab", "yuooo", "aacd", "aaca",                     "aaac", "aazs", "desed" };    BubbleSort ( a , 10 );    BubbleSort ( s , 11 );        for ( i = 0; i < 10 ; ++i ) {        std::cout<< "a[ " << i << " ] = "<< a[ i ] << std::endl;    }          std::cout << std::endl;    for ( i= 0; i < 11 ; ++i ) {        std::cout<< "s[ " << i << " ] = "<< s[ i ] << std::endl;    }    system ( "pause" );    return 0;}