例子

编辑首次使用

#pragma once
/*template  void swap(T& a, T& b) {
	T temp = a;
	a = b;
	b = temp;
}*/
void bubblesort1a(int* data, int n) {
	bool sorted = false;
	while(!sorted){
		sorted = true;
		for (unsigned i=0;i  *(data+i+1)) {
				//swap(i, i + 1);
				sorted = false;
			}
		}
		n--;
	}


你可能感兴趣的:(例子)