摘要:
#ifndef __MyConsole__Stack__#define __MyConsole__Stack__#include templateclass Stack{public: explicit Stack(int size); ~Stack(); bool IsEmpty(); int CurrentSize(); bool Push(const T& item); bool IsFull(); void ShowStack(); bool Pop(T *pResult);private: int top; int maxSize; T *data; };us... 阅读全文
摘要:
void BubbleSort(int datas[], int len){ int tem; bool isSorted = false; for (int i = len - 1; isSorted == false && i >= 1; --i) { isSorted = true; for (int j = 0; j datas[j + 1]) { isSorted = false; tem = datas[j]; datas[j] = datas[j + 1]; datas[j + 1] = tem; ... 阅读全文
摘要:
void SelectSort(int datas[], int len){ int tem; for (int i = 0; i datas[j]) { tem = datas[i]; datas[i] = datas[j]; datas[j] = tem; } } } for (int k = 0; k < len; ++k) { std::cout << datas[k] << " " ; } cout << endl;} 阅读全文