随笔分类 - C/C++
摘要:## 1、安装cmake > 如果没有cmake或者cmake版本太旧,都需要进行重新安装 > 此次推荐直接安装编译好的软件包 进入官网:https://cmake.org/download/  %ld 十进制整数(long) %f 十进制浮点数(float) %lf 十进制浮点数(double) %o 八进制数 %s 字符串(char) %u 无符号十进制数(DWORD) %x 十六进制数(0x00000) 举例 printf( "%4d"
阅读全文
摘要:文章目录 一、相关知识二、基本套接字1、REQ-REP模式2、PUSH-PULL模式3、PUB-SUB模式4、DEALER-ROUTER模式5、PAIR-PAIR模式 结语 一、相关知识 1、基础API接口 创建和销毁套接字:zmq_socket(), zmq_close() 配置和读取套接字选项:
阅读全文
摘要:C语言头文件 <ctype.h> 字符处理函数: 本类别函数用于对单个字符进行处理,包括字符的类别测试和字符的 大小写转换 字符测试是否字母和数字 isalnum 是否字母 isalpha 是否控制字符 iscntrl 是否数字 isdigit 是否可显示字符(除空格外) isgraph 是否可显示
阅读全文
摘要:1.链队结构 typedef struct queuenode { int data; struct queuenode *next; }Queue; typedef struct { Queue *fronts,*rear; }linkqueue; 2.入队操作 //进队函数 void inQue
阅读全文
摘要:首先先来认识下EasyX EasyX 是针对 C/C++ 的图形库,可以帮助使用C/C++语言的程序员快速上手图形和游戏编程。 比如,可以用 VC + EasyX 很快的用几何图形画一个房子,或者一辆移动的小车,可以编写俄罗斯方块、贪吃蛇、黑白棋等小游戏,可以练习图形学的各种算法,等等。 文章目录
阅读全文
摘要:链表也就是线性链 单向链表的结构体指针 typedef struct linknode { datatype data; struct linknode *next; }Linknode; datanext 链表插入: 1.插入指针p之后 ① s->next = p->next; ②p->next
阅读全文
摘要:#include <iostream> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <arpa/inet.h> #define uint unsigned int #d
阅读全文
摘要:C语言字符串去除后面的无用字节(可用于进程间通信) #include <stdio.h> #include <string.h> #define dPrint(fmt, ...) do{fprintf(stderr, "[%s:%d] " fmt "\r\n", __FUNCTION__, __LI
阅读全文
摘要:函数说明: void line( int x1, int y1, int x2, int y2 ); 参数 x1 直线的起始点的 x 坐标。 y1 直线的起始点的 y 坐标。 x2 直线的终止点的 x 坐标。 y2 直线的终止点的 y 坐标。 文件素材 源代码 #include <graphics.
阅读全文
摘要:** 自行实现pow函数 ** 因程序内部存在pow函数,为避免冲突,自定义的函数名改为power #include<stdio.h> #include<stdlib.h> //自行实现pow函数 //求第一个参数的n次幂 //double numl,int num2 形式参数 double pow
阅读全文
摘要:C/C++多线程与互斥锁 //获取线程ID: //方法1、 void* thread(void *id){ printf("this is a new thread, thread ID is %u\n", pthread_self()); return NULL; } //方法2、 #includ
阅读全文
摘要:C语言递归函数 1.求阶乘: #include<stdio.h> int recursion(int num) { if(num==1) return 1; else { num=num*recursion(num-1); return num; } } int main() { int i; pr
阅读全文
摘要:C语言实现背包商城的小项目 简介: 用C语言实现 1.账号登录(包括创建账号) 2.个人账号信息显示 3.背包操作 4.商城操作 5.背包升级 6.切换账号与退出游戏 源代码 #include <stdio.h> #include <stdlib.h> #include <string.h> /*
阅读全文
摘要:#include <iostream> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <string.h> #define HexPrint(_buf, _len) \ {\
阅读全文
摘要:该实例实现ARP反向代理 #include <stdio.h> #include <string.h> #include <pthread.h> #include <pcap.h> #include <assert.h> #include <stdbool.h> #define RECV_SEND_
阅读全文
摘要:#define HexPrint(_buf, _len) \ {\ int _m_i = 0;\ char *_m_buf = (char *)(_buf);\ int _m_len = (int)(_len);\ printf("[%s:%d] \r\n", __FUNCTION__, __LIN
阅读全文
摘要:/*头文件*/ #include <semaphore.h> /*声明与定义*/ extern sem_t s_update_info_sem; sem_t s_update_info_sem; /*创建信号灯*/ int ret = sem_init(&s_update_info_sem, 0,
阅读全文
摘要:#include <iostream> #include <vector> using namespace std; int main() { vector<int>m; m.push_back(1); m.push_back(2); m.push_back(3); for(std::vector<
阅读全文
摘要:C语言Socket编程(TCP与UDP) UDP: //udp_server.c: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #i
阅读全文