摘要: #!/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行者 阅读(294) 评论(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行者 阅读(368) 评论(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行者 阅读(209) 评论(0) 推荐(0) 编辑