p34.cpp

来自「包含常见的数据结构的类和函数」· C++ 代码 · 共 24 行

CPP
24
字号
#include <datalist.h>#include <selecttm.h>template < class Type > void dataList <Type> :: BubbleSort() {    int i = 1;    int exchange = 1;    while ( i < ArraySize && exchange ) {	BubbleExchange ( i, exchange );	i++;    }}template < class Type > void dataList <Type> :: BubbleExchange ( const int i, int & exchange ) {    exchange = 0;    for ( int j = ArraySize - 1; j>=i; j-- )      if ( Element[j-1] > Element[j] ) {	  Swap (j-1,j);	  exchange = 1;      }}void main() {    dataList<int> abc;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?