摘要: 关键是如何把MFC中代表整数的控件,让我想把他换为0-1之内的小数时,如何改变原来的代码,使二者在实现上没有多大差别,这是个问题啊,看来得努力了! 阅读全文
posted @ 2011-06-10 23:06 hailong 阅读(171) 评论(0) 推荐(0) 编辑
摘要: #include <string>#include <iostream>#include<vector>using namespace std;int main(){ vector<int> a(10,0); for (size_t i = 0; i < a.size(); ++i) { a[i] = i+1; }} 阅读全文
posted @ 2011-06-10 20:14 hailong 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 普通数组:#include <string>#include <iostream>#include<vector>using namespace std;template<class T>bool is_equal(T *a, int size_a,T * b, int size_b){ if (size_b !=size_a) return false; for (int i = 0; i < size_a; ++i) if (a[i] != b[i]) return false; return true;}int main(){ int 阅读全文
posted @ 2011-06-10 20:04 hailong 阅读(1091) 评论(0) 推荐(0) 编辑
摘要: 用模板写一个:#include <string>#include <iostream>#include<vector>using namespace std;template<class T>T* copy(T *a,int size){ T* b = new T[size]; for (int i = 0; i < size; ++i) { b[i] = a[i]; } return b;}int main(){ int a[] = {1,2,3,4}; int size = sizeof(a)/sizeof(*a); int *b = 阅读全文
posted @ 2011-06-10 19:47 hailong 阅读(338) 评论(0) 推荐(0) 编辑