摘要: how to Produce More Brain Cells 阅读全文
posted @ 2021-06-07 15:18 super行者 阅读(37) 评论(0) 推荐(0) 编辑
摘要: stumble across 偶然遇到 it would be easier for me to do something 做XXX更方便 阅读全文
posted @ 2019-01-18 04:41 super行者 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 1.在C++中,只要不明确指定是public,默认是private 2.virtual关键字主要是实现动态绑定。要触发动态绑定,必须满足两个条件: 第一,指定为虚函数; 第二,通过基类类型的引用或指针调用。 只要基函数定义了virtual,继承类的该函数也就具有virtual属性 纯虚函数为后代类提 阅读全文
posted @ 2018-12-10 21:20 super行者 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Steve Jobs' Last and Best Speech 阅读全文
posted @ 2021-06-08 16:36 super行者 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 这两天我花了很多时间实现一直以来的一个想法,那就是可以用某个手机APP来背自己汇集的单词本。 其实以前也是知道有Anki, 只是没想到它对于定制词库如此的有效而强大。我在网上搜寻哪些APP可以使用定制词库背单词,看到几款推荐的APP中第一个就是Anki,于是决定还是先研究一下它。昨天我为有道单词和A 阅读全文
posted @ 2020-07-17 22:47 super行者 阅读(1720) 评论(1) 推荐(0) 编辑
摘要: 1.定义struct template 2.在类模板外定义各方法 阅读全文
posted @ 2019-01-18 07:06 super行者 阅读(331) 评论(0) 推荐(0) 编辑
摘要: The Python Tutorial Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective 阅读全文
posted @ 2019-01-13 05:00 super行者 阅读(223) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; template class my_binder1st { public: my_binder1st(const Operation op, const Para first): m_op(op), m_first(first) { } Para operato... 阅读全文
posted @ 2019-01-06 09:16 super行者 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 函数对象,就是一个重载了"()"运算符的类的对象,它可以像一个函数一样使用。 STL中提供了一元和二元函数的两种函数对象:(都是模板) 一元函数对象: 二元函数对象: 下面是一段示例代码: 另一段示例代码: 阅读全文
posted @ 2019-01-05 20:27 super行者 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 运行后屏幕输出为:说明出现异常后auto_ptr指向的对象的析构函数仍然被执行了。 如果把上面代码中注释掉的代码打开,如下: 执行后屏幕显示如下:因为没有运用auto_ptr而用的裸指针,可以看到析构函数没有被调用 阅读全文
posted @ 2019-01-05 19:23 super行者 阅读(832) 评论(0) 推荐(0) 编辑
摘要: /* erase()删除指定元素,元素个数减1,即size-- remove()同时删除所有指定值的元素,其它元素前移补位,但元素总个数不变(size不变) */ #include #include #include using namespace std; template void print (vector &x) { typename vector::i... 阅读全文
posted @ 2019-01-04 22:33 super行者 阅读(283) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; /* demonstrate algorithm: find, for_each demonstrate reverse_iterator */ void print (int x) { cout d; for (int i=1; i::iterator p... 阅读全文
posted @ 2019-01-04 20:37 super行者 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; int main() { // demonstrate reverse an int array int a[4] = {3,2,4,1}; reverse(a,a+4); cout... 阅读全文
posted @ 2019-01-03 19:55 super行者 阅读(229) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; bool fncomp (char lhs, char rhs) {return lhs>rhs;} struct classcomp { bool operator() (const char& lhs, const char& rhs) const { return lhs> maps... 阅读全文
posted @ 2019-01-02 21:44 super行者 阅读(847) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int main() { set st; st.insert("apple"); st.insert("orange"); st.insert("strawberry"); st.insert("peach"); st.insert("orange");... 阅读全文
posted @ 2019-01-02 21:03 super行者 阅读(108) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; int main() { stack> s; queue> q; // the default container of queue is deque for (int i = 0; i < 10; i++) { ... 阅读全文
posted @ 2018-12-28 06:42 super行者 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Vector: 动态数组,内存中一整块连续区域。支持.reserve()和.capacity()。为提高效率,最好在添加元素之前用.reserve()分配好容量。插入删除操作越靠近数组首部效率越低。 deque(double ended queue): 动态数组,内存中多段连续区域拼凑。不支持res 阅读全文
posted @ 2018-12-28 05:13 super行者 阅读(144) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; template bool decreOrder(T &a, T &b) { return (a bool increOrder(T &a, T &b) { return (a > b); } template void Sort(vector & v, bool (*... 阅读全文
posted @ 2018-12-27 05:36 super行者 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 参考本博客中链接 《C++ vector 删除符合条件的元素》 阅读全文
posted @ 2018-12-27 04:45 super行者 阅读(477) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; template bool increSort(T &a, T &b) { return (a > b); } template bool decreSort(T &a, T &b) { return (a void Sort(T* array, int len, bool(*compare)(T&, T&)) ... 阅读全文
posted @ 2018-12-25 07:39 super行者 阅读(295) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; template class Stack { public: Stack() { } ~Stack() { } void push(T &e) { m_list.push_front(e); } void pop()... 阅读全文
posted @ 2018-12-25 06:37 super行者 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python import xml.etree.ElementTree as etree tree = etree.parse(wordbook.xml')root = tree.getroot()print len(root) entries = tree.findall(' 阅读全文
posted @ 2018-12-23 19:36 super行者 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 看这篇帖子的,我想都是电子爱好者或电类专业学生。不知道大家都处于什么一个阶段,这篇帖子是写给入门者的,要解决一个问题:初学者应重点掌握什么电子知识,大学阶段如何学习? 先说点貌似题外的东西——3个谬论。 谬论一:高中老师常对我们说,大家现在好好学,考上了大学就轻松了,爱怎么玩怎么玩。这真是狗屁。别的 阅读全文
posted @ 2018-12-23 19:27 super行者 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; // rever letters of a string char * strRevert1 (char * src) { if (src == NULL) return NULL; int len = strlen(src); for (int i=0; i= pWord); ... 阅读全文
posted @ 2018-12-23 19:19 super行者 阅读(117) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; unsigned int strlen1(const char * str) { const char * p = str; while (*p++ != '\0'); return (p-1-str); } int main() { char a[] = "12345"; cout << st... 阅读全文
posted @ 2018-12-23 19:19 super行者 阅读(133) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; bool checkRevStr (const char * src) { if (src == NULL) return false; const char * end = src + strlen(src) - 1; while (*src++ == *end--); retur... 阅读全文
posted @ 2018-12-23 19:18 super行者 阅读(148) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int strcmp1 (const char * a, const char * b) { int ret = 0; while (!(ret=*a-*b) && *b) { ++a; ++b; } return (ret>0)?(1):((... 阅读全文
posted @ 2018-12-23 19:17 super行者 阅读(293) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; const char * findFirstLongestStr (const char * src, const char * des, unsigned int & count) { if (src==NULL || des==NULL) return NULL; int desLen = st... 阅读全文
posted @ 2018-12-23 19:16 super行者 阅读(415) 评论(0) 推荐(0) 编辑
摘要: 例如字符串aabbbc,插入字符个数后变成aa2bbb3c1 阅读全文
posted @ 2018-12-23 19:15 super行者 阅读(248) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; void printBit (unsigned int value) { unsigned int bits = sizeof(unsigned int) * 8; stringstream s; for (int i=0; i> bits-1-i; s > (bits-1-... 阅读全文
posted @ 2018-12-23 19:15 super行者 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 1. 把字母替换成它后面的第4个字母。如:a->e, A->E, X->b, y->c 2. 翻转整个字符串 阅读全文
posted @ 2018-12-23 19:14 super行者 阅读(226) 评论(0) 推荐(0) 编辑
摘要: empty() 堆栈为空则返回真 pop() 移除栈顶元素 push() 在栈顶增加元素 size() 返回栈中元素数目 top() 返回栈顶元素 阅读全文
posted @ 2018-12-23 19:13 super行者 阅读(206) 评论(0) 推荐(0) 编辑
摘要: include #include using namespace std; bool strToInt (char * strIn, int * valueOut) { if ((strIn==NULL) || (valueOut==NULL)) { return false; } bool status = false; int v... 阅读全文
posted @ 2018-12-23 19:12 super行者 阅读(148) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; char * strcpy1 (char * strDest, char * strSrc) { if ((strDest==NULL) || (strSrc==NULL)) { return NULL; } char * strDeskCpy = strDest; while ... 阅读全文
posted @ 2018-12-23 19:11 super行者 阅读(203) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; void * memcpy1 (void * desAddr, const void * srcAddr, unsigned int count) { assert ((desAddr!=NULL) && (srcAddr!=NULL)); char * from = NULL; char ... 阅读全文
posted @ 2018-12-23 19:10 super行者 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; const char * strstr1 (const char * src, const char * des) { assert ((src!=NULL)&&(des!=NULL)); int srcLen = strlen(src); int desLen = st... 阅读全文
posted @ 2018-12-23 19:09 super行者 阅读(210) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; char * revStrExcludeSub (char * src, char * sub) { if ((src==NULL) || (sub==NULL)) return NULL; char * head=src, * tail=src, * pSub=sub; ... 阅读全文
posted @ 2018-12-23 19:08 super行者 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; char * revStr (char * src, int len) { if (len <= 1) return src; *src ^= *(src+len-1); *(src+len-1) ^= *src; *src ^= *(src+len-1); return (... 阅读全文
posted @ 2018-12-23 19:07 super行者 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int validateInt (const char * src) { if (src == NULL) return 0; const char * p = src; while (*p>='0' && *p st; while (pA >= a) {... 阅读全文
posted @ 2018-12-23 19:06 super行者 阅读(366) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; // not using string library char * rightLoop1 (char * src, int n) { if (src==NULL) return NULL; char * p = src; while (*p++); int len = p-1-sr... 阅读全文
posted @ 2018-12-23 19:05 super行者 阅读(332) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; // pos starting from 0 char * deleteChars1 (char * src, int pos, int len) { if ((src==NULL) || (posp) || (src+pos+len-1>p)) return NULL; memcpy (src+p... 阅读全文
posted @ 2018-12-23 19:04 super行者 阅读(208) 评论(0) 推荐(0) 编辑