上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 89 下一页
摘要: history 查看历史命令 ctrl+p 向上翻历史纪录 ctrl+n 向下翻历史纪录 ctrl+b 光标向左移动 ctrl+f 光标向右移动 ctrl+a 光标移动到行首 ctrl+e 光标移动到行尾 ctrl+h 删除光标前一个 ctrl+d 删除光标后一个 ctrl+u 删除光标前所有 ct 阅读全文
posted @ 2019-07-31 19:07 王清河 阅读(186) 评论(0) 推荐(0) 编辑
摘要: C++继承 面向对象程序设计中最重要的一个概念就是继承,继承允许我们以及另一个类来定义一个类,这使得创建和维护一个应用程序变得更容易,这样做也可以达到重用代码功能和提高执行时间的效果。 当创建一个类时,不需要重新编写新的数据成员和成员函数,只需要指定新建的类继承一个已有的类的成员即可,这个已有的类被 阅读全文
posted @ 2019-07-31 10:17 王清河 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 运行结果: ubuntu1604@ubuntu:~/wangqinghe/C/20190730$ gcc reverse.c -o reverse ubuntu1604@ubuntu:~/wangqinghe/C/20190730$ ./reverse 0 9 8 7 6 5 4 3 2 1 0 r 阅读全文
posted @ 2019-07-30 17:28 王清河 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #include #include struct list { int data; struct list *next; }; //建立链表节点 struct list *create_list() { return calloc(sizeof(struct list),1); } //往链表的第n个节点插入新节点 struct list *insert_list(... 阅读全文
posted @ 2019-07-30 17:06 王清河 阅读(139) 评论(0) 推荐(0) 编辑
摘要: //前提是查找的数组已是有序 #include //非递归 int binary(int *arr,int low,int high,int key) { while(low arr[mid]) { low = mid + 1; } else { high = mid ... 阅读全文
posted @ 2019-07-29 21:36 王清河 阅读(165) 评论(0) 推荐(0) 编辑
摘要: #include void swap(int *a,int *b) { int temp = *a; *a = *b; *b = temp; } int MinKey(int *arr,int low,int high) { int min = low; int key = arr[low]; int i; for(i = low + ... 阅读全文
posted @ 2019-07-29 19:12 王清河 阅读(113) 评论(0) 推荐(0) 编辑
摘要: #include void swap(int *a,int *b) { int temp = *a; *a = *b; *b = temp; } void bubble(int array[],int n) { int i; int j; for(i = 0; i array[j]) swap(&array[j... 阅读全文
posted @ 2019-07-29 18:58 王清河 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 有时候我们需要用到线程同步来控制线程运行顺序。 exbot@ubuntu:~/wangqinghe/thread/20190729$ ./synchro 2 thread0 1 thread0 2 thread1 1 thread1 2 thread2 1 thread2 2 thread3 1 t 阅读全文
posted @ 2019-07-29 16:31 王清河 阅读(173) 评论(0) 推荐(0) 编辑
摘要: int pthread_cancel(pthread_t th); 该函数运行一个线程取消指定的另一个线程th 函数成功,返回0,否则,返回非0; 函数运行结果: exbot@ubuntu:~/wangqinghe/thread/20190729$ ./cancel thread_create su 阅读全文
posted @ 2019-07-29 16:30 王清河 阅读(118) 评论(0) 推荐(0) 编辑
摘要: int pthread_detach(pthread_t th); pthread_detach函数使线程处于被分离状态。 如果不等待一个线程,同时对线程的返回值不感兴趣,可以设置这个线程为分离状态,让系统在线程退出的时候自动回收它所占用的资源。 一个线程不能自己调用pthread_detach改变 阅读全文
posted @ 2019-07-29 16:29 王清河 阅读(243) 评论(0) 推荐(0) 编辑
上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 89 下一页