摘要: http://www.cnblogs.com/haippy/p/3346477.html http://www.cplusplus.com/reference/mutex/lock_guard/ http://www.cplusplus.com/reference/mutex/unique_lock 阅读全文
posted @ 2016-09-10 09:26 于光远 阅读(214) 评论(0) 推荐(0)
摘要: 带参数 传引用 线程调用:类重载() std::thread t3{ SayHello() }; t3.join(); 线程调用:类成员函数: 阅读全文
posted @ 2016-09-09 19:20 于光远 阅读(138) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/zhuyp1015/archive/2012/04/08/2438288.html C++11提供了新头文件<thread>、<mutex>、<atomic>、<future>等用于支持多线程。 基本形式 支持stl和lambda 可以通过sleep_f 阅读全文
posted @ 2016-09-09 16:48 于光远 阅读(177) 评论(0) 推荐(0)
摘要: 思路:有两个栈,栈1和栈2.当入栈的时候,我们将它全放进栈1中,当需要出栈的时候,我们将栈1出栈到栈2中,然后再将栈2依次出栈 阅读全文
posted @ 2016-09-09 15:37 于光远 阅读(163) 评论(0) 推荐(0)
摘要: http://www.cr173.com/html/18891_1.html http://www.nowcoder.com/practice/8a19cbe657394eeaac2f6ea9b0f6fcf6?tpId=13&tqId=11157&rp=1&ru=/ta/coding-intervi 阅读全文
posted @ 2016-09-09 14:29 于光远 阅读(388) 评论(1) 推荐(0)
摘要: 洗牌在生活中十分常见,现在需要写一个程序模拟洗牌的过程。 现在需要洗2n张牌,从上到下依次是第1张,第2张,第3张一直到第2n张。首先,我们把这2n张牌分成两堆,左手拿着第1张到第n张(上半堆),右手拿着第n+1张到第2n张(下半堆)。接着就开始洗牌的过程,先放下右手的最后一张牌,再放下左手的最后一 阅读全文
posted @ 2016-09-08 14:57 于光远 阅读(312) 评论(0) 推荐(0)
摘要: #include struct stack { char space[512]; int top; }; struct stack stack = { { 0 }, 0 }; int isempty(){ return stack.top == 0; } int isfull(){ return stack.top == 512; } void push(cha... 阅读全文
posted @ 2016-09-07 11:02 于光远 阅读(225) 评论(0) 推荐(0)
摘要: 三个函数的申明分别是: void* realloc(void* ptr, unsigned newsize); void* malloc(unsigned size); void* calloc(size_t numElements, size_t sizeOfElement); 都在stdlib. 阅读全文
posted @ 2016-09-07 09:35 于光远 阅读(186) 评论(0) 推荐(0)
摘要: http://classfoo.com/ccby/article/jnevK 对象 阅读全文
posted @ 2016-09-06 14:00 于光远 阅读(203) 评论(0) 推荐(0)
摘要: http://classfoo.com/ccby/article/cIBahI 阅读全文
posted @ 2016-09-06 12:09 于光远 阅读(197) 评论(0) 推荐(0)