上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 66 下一页
  2021年10月19日
摘要: 一、概述 案例:回顾string字符串相关操作。 二、代码示例 #include <iostream> #include <string> #include <vector> using namespace std; void test(){ string str; str = "luoluoyan 阅读全文
posted @ 2021-10-19 13:40 飘杨...... 阅读(69) 评论(0) 推荐(0)
摘要: 一、概述 案例:练习vector容器(基本数据类型、自定义类型、容器嵌套容器),并输出vector容器中的内容 开发工具:sublinetext 二、示例图片 三、示例代码 #include <iostream> #include <vector> #include <string> #includ 阅读全文
posted @ 2021-10-19 11:14 飘杨...... 阅读(68) 评论(0) 推荐(0)
  2021年10月18日
摘要: 一、概述 案例:使用posix线程模型,实现一个最简单的生产者消费者模型。用一个全局的int类型的变量来表示产品。用一个生产者线程生产产品,初始产品数量为0,只有当生产10个产品的时候,消费者线程才会启动,开始消费。 当消费者线程把产品消费完(产品数为0)的时候通知生产者继续生产产品,生产到10个再 阅读全文
posted @ 2021-10-18 16:08 飘杨...... 阅读(124) 评论(0) 推荐(0)
  2021年10月15日
摘要: 一、概述 案例:使用posix线程模型编写一小案例:两个线程做加和操作,其中一个线程从1加到50,另外一个线程从51加到100.使其最后结果等于5050 二、示例代码 // 创建两个线程共同操作0~100相加 // Created by wei.yang on 2021/10/15. // #inc 阅读全文
posted @ 2021-10-15 13:26 飘杨...... 阅读(112) 评论(0) 推荐(0)
摘要: 一、概述 案例:使用posix线程模型创建一个线程,在线程执行方法中从0打印到9,并给执行方法传递参数。 二、示例图片 三、代码示例 // posix线程模型创建一个最简单的线程 // Created by wei.yang on 2021/10/15. // #include "create_a_ 阅读全文
posted @ 2021-10-15 10:31 飘杨...... 阅读(137) 评论(0) 推荐(0)
  2021年10月12日
摘要: 一、概述 案例:写一个小案例来测试C的带参数的回调函数 二、代码实例 #include <stdio.h> #include <stdlib.h> #include <string.h> /** * 回调函数定义 * * */ int callback(int x,int y){ printf("m 阅读全文
posted @ 2021-10-12 13:54 飘杨...... 阅读(260) 评论(0) 推荐(0)
  2021年10月11日
摘要: 一、概述 案例:使用C语言实现字符串的逆序,用数组和指针两种方式实现。 二、代码示例 #include <iostream> #include <string.h> using namespace std; //字符串逆序,数组实现 void reserveStr(char *src,char* r 阅读全文
posted @ 2021-10-11 17:00 飘杨...... 阅读(901) 评论(0) 推荐(0)
摘要: 一、概述 案例:利用for改造上一节的服务端程序,让其能够和多个客户端之间收发数据。Client端代码请参考上一篇 二、代码示例 #include <iostream> #include <sys/socket.h> #include <netinet/in.h> #include <unistd. 阅读全文
posted @ 2021-10-11 13:14 飘杨...... 阅读(248) 评论(0) 推荐(0)
摘要: 一、概述 案例:使用C语言编写一个函数,来实现字符串的copy。 二、代码示例 #include <iostream> using namespace std; /** * 使用数组 copy * */ void mystrcopy(char *str1,char* str2){ int i =0; 阅读全文
posted @ 2021-10-11 11:19 飘杨...... 阅读(1494) 评论(0) 推荐(0)
摘要: 一、概述 案例:使用C语言编写一个函数,次函数中实现两个阿拉伯数字的值的交换。 二、代码实例 #include <iostream> using namespace std; void swap(int,int); void swap2(int * ,int *); int main(int arg 阅读全文
posted @ 2021-10-11 11:06 飘杨...... 阅读(218) 评论(0) 推荐(0)
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 66 下一页