摘要:Word AmalgamationIn millions of newspapers across the United States there is a word game calledJumble. The object of this game is to solve a riddle, b...
阅读全文
摘要:如果编写的判断式不满足strict weak ordering,就会出现Invalid operator< assertion error错误。网页:http://support.microsoft.com/kb/949171VS(其他编译器还没试过)中,sort函数要求比较函数是strict we...
阅读全文
摘要:阅读另一篇博文Uva 642 - Word Amalgamation sort qsort1.qsort函数:原型:void qsort(void *base, int nelem, int width, int (*fcmp)(const void *,const void *));功能:使用快速...
阅读全文
摘要://// main.cpp// opencv3//// Created by PKU on 14-9-16.// Copyright (c) 2014年 PKU. All rights reserved.//#include using namespace cv;using namespac...
阅读全文
摘要:map 是以 pair形式插入的。map中的元素的类型value_typetypedef pair value_type;value_type 被声明为 pair 但并不是简单的 pair 因为用一个非常量的迭代器或引用不能改变关联容器的Key。#include #include int mai...
阅读全文
摘要://// main.cpp// setcmp//// Created by IDM-PKU on 14-9-6.// Copyright (c) 2014年 PKU. All rights reserved.//#include #include #include "print.hpp"us...
阅读全文
摘要://// main.cpp// function_adaptor//// Created by IDM-PKU on 14-9-3.// Copyright (c) 2014年 PKU. All rights reserved.//#include #include #include #in...
阅读全文
摘要:一、什么是异常处理 一句话:异常处理就是处理程序中的错误。二、为什么需要异常处理,以及异常处理的基本思想 C++之父Bjarne Stroustrup在《The C++ Programming Language》中讲到:一个库的作者可以检测出发生了运行时错误,但一般不知道怎样去处理它们(因为和用户具...
阅读全文
摘要:#include #include #include #include #include void output(const std::string & s){std::cout words(4); copy(s1,s1+4,words.begin()); for_each(words...
阅读全文
摘要:#include #include #include int main(){ using namespace std; int casts[10]={6,7,2,9,4,11,8,7,10,5}; vector dice(10); copy(casts,casts+10,di...
阅读全文
摘要:#include using std::cout;using std::endl;void change(const int * pt, int n);int main(){ int pop1=38383; const int pop2=2000; cout (pt); *p...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using std::cout; 7 class Grand 8 { 9 private:10 int hold;11 public:12 Gr...
阅读全文
摘要:#include #include #include using std::cout;class Grand{ private: int hold; public: Grand(int h=0):hold(h){} virtual void Speak() const {cout Speak(...
阅读全文
摘要:#include #include #include #include #include void *sigone_program(void *arg);void *sigtwo_program(void *arg);void report(int);int main(int argc,char *...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 static pthread_rwlock_t rwlock; 7 #define WORK_SIZE 1024 8 char work_area[WORK_...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 6 #define BUFFER_SIZE 2 7 struct prodcons 8 { 9 int buffer[BUFFER_SIZE]; 10 pthre...
阅读全文
摘要:#include #include #include #include void *thread_function(void *arg);pthread_mutex_t work_mutex;#define WORK_SIZE 1024char work_area[WORK_SIZE];int ti...
阅读全文
摘要:共享全局变量实例:#include #include #include #include int key=100;void *helloworld_one(char *argc){ printf("the message is %s\n",argc); key=10; printf...
阅读全文
摘要:#include #include #include #include void cleanup(){ printf("cleanup\n");}void *test_cancel(void){ pthread_cleanup_push(cleanup,NULL); printf(...
阅读全文
摘要:#include #include #include #include struct message{ int i; int j;};void *hello(struct message *str){ printf("child, the tid=%lu, pid=%d\n",pt...
阅读全文