自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 资源 (2)
  • 收藏
  • 关注

原创 WiFi station模式:wpa_supplicant 工具 wpa_cli 使用

首先需要启动wpa_supplicant 指定wlan0的路径。#选择网络0(这样做的好处在于,可以取消先前的其它网络连接)#将id0的网络移除掉,必须先断开才行。#获取一个存储wifi结构的id,假设为1,递增。#保存刚刚填写的wifi帐号,写入配置文件。#设置当前网络优先级,默认为2,可以不加。#设置ssid默认为1即可 ,可以不加。#设置ID为1的热点SSID,id1。#搜索附近网络,并列出结果。#设置ID为1的热点的密码。#启动连接ID为1的网络。#将id0的网络进行断开。

2023-08-29 11:44:37 574

原创 C++ 外观模式

#include<iostream>using namespace std;class light{ public: void on() { cout<<"开灯"<<endl; } void of() { cout<<"关灯"<<endl; }};class TV{ pub.

2021-10-08 10:41:21 145

原创 C++ 饿汉式单例

#include<iostream>//恶汉式单例#include<pthread.h>#include<unistd.h>using namespace std;class singletion//单例类{ public: static singletion * getinstance()//提供给外部的创建对象的接口 { objcount++; .

2021-10-08 10:40:28 209

原创 C++ 懒汉式单例

#include<iostream>//懒汉式单例#include<pthread.h>#include<unistd.h>using namespace std;pthread_mutex_t mutex;//线程的同步机制问题class singletion//单例类{ public: static singletion * getinstance()//提供给外部的创建对象的接口 { s.

2021-10-08 10:39:50 129

原创 C++ 抽象工厂模式

#include<iostream>using namespace std;class car{ public: void setengine(string engine){m_engine = engine;} void setwheel(string wheel){m_wheel = wheel;} void setbody(string body){m_body = body;} void display(.

2021-10-08 10:37:18 60

原创 C++ 工厂方法模式

#include<iostream>using namespace std;class car//抽象类{ public: virtual void construct() = 0; };class BMW:public car{ public: void construct() { cout<<"造一辆宝马汽车"<<endl; }}.

2021-10-08 10:32:21 45

原创 C++ 简单工厂模式

#include<iostream>using namespace std;class car{ public: void setengine(string engine){m_engine = engine;} void setwheel(string wheel){m_wheel = wheel;} void setbody(string body){m_body = body;} void display(.

2021-10-08 10:31:36 57

原创 c++ adapter适配器的使用

#include<iostream>using namespace std;class USB{ public: virtual void isUSB() { cout<<"这是一个USB接口!"<<endl; }};class typec{ public: virtual void istypec() { co.

2021-10-08 10:28:34 78

原创 C++ algorithm部分实现

// #include <iostream>// #include <algorithm>// #include <vector>// #include <list>// #include <time.h>// #include<numeric>#include<bits/stdc++.h>//万能头文件using namespace std;void print(int x){ cout &.

2021-10-08 10:27:18 113

原创 C++ 公司管理系统:公司招聘5个新员工,指派员工到部门工作销售部,研发部,财务部姓名,年龄,电话,工资分部门的显式员工的信息,显示所有员工的信息

#include<iostream>#include<map>#include<vector>#include<ctime>using namespace std;#define sale 1 //销售部#define develop 2//研发部#define finacial 3 //财务部class worker{ public: string m_name; int m_age;.

2021-10-08 10:25:17 449

原创 iterator 迭代器

#include<iostream>#include<iterator>#include<vector>#include<list>using namespace std;template<typename T>void print(T t){ typename T::iterator it_s = t.begin();//typename表明T是一种数据类型 typename T::iterator it_e .

2021-10-08 10:23:55 60

原创 c++ tuple的使用

#include<iostream>#include<tuple>using namespace std;int main(){ tuple<int,string,float> t1(1,"张三",90.5);//借用对象的构造函数赋值 auto t2 = make_tuple(2,"李四",90.5); int id ; string name; float score; tie(id,name,score) .

2021-10-07 22:52:25 350

原创 C++ set的使用

#include<iostream>#include<set>using namespace std;void print(multiset<int,greater<int>> &v){ auto it_s = v.begin(); //迭代器,begin函数,返回的是容器的头元素 auto it_e = v.end(); // end,返回容器尾元素 while(it_s != it_e) .

2021-10-07 22:51:24 72

原创 C++ map的使用

#include<iostream>#include<map>using namespace std;void print(multimap<int,string> &v){ auto it_s = v.begin(); //迭代器,begin函数,返回的是容器的头元素 auto it_e = v.end(); // end,返回容器尾元素 while(it_s != it_e) { co.

2021-10-07 22:50:24 36

原创 C++ list的使用

#include<iostream>#include<list>using namespace std;void print(list<int> &v){ auto it_s = v.begin(); //迭代器,begin函数,返回的是容器的头元素 auto it_e = v.end(); // end,返回容器尾元素 while(it_s != it_e) { cout<<.

2021-10-07 22:49:25 64

原创 C++ queue的使用

#include<iostream>#include<deque>using namespace std;void print(deque<int> &v){ auto it_s = v.begin(); //迭代器,begin函数,返回的是容器的头元素 auto it_e = v.end(); // end,返回容器尾元素 while(it_s != it_e) { cout<&l.

2021-10-07 22:48:33 77

原创 C++ vector 容器的使用

#include<iostream>#include<vector>using namespace std;void print(vector<int> &v){ vector<int>::iterator it_s = v.begin(); //迭代器,begin函数,返回的是容器的头元素 vector<int>::iterator it_e = v.end(); // end,返回容器尾元素 .

2021-10-07 22:44:43 46

原创 C语言线程,有四个线程1、2、3、4。线程1的功能就是输出1,线程2的功能就是输出2,以此类推.........现在有四个文件ABCD。初始都为空。现要让四个文件呈如下格式:A:1 2 3 4 1 2

#include <stdio.h>#include <stdlib.h>#include <pthread.h>#include <errno.h>FILE *f1;FILE *f2;FILE *f3;FILE *f4;pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;pthread_cond_t condA_B = PTHREAD_COND_INITIALIZER;pthread_.

2021-10-07 22:23:42 341

原创 C语言 编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推。

#include <stdlib.h> #include<stdio.h>#include <pthread.h> #include <unistd.h> #include <string.h> pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;pthread_cond_t qready = PTHREAD_COND_INITIALIZER; void.

2021-10-07 22:22:39 1887 1

原创 C语言子线程循环 3 次,接着主线程循环 6 次,接着又回到子线程循环 3 次,接着再回到主线程又循环6 次,如此循环50次,试写出代码。

#include<stdio.h>#include<stdlib.h>#include<pthread.h>#include<unistd.h>int count = 0; void * thread_func(void) { int child = 1; while(1) { if(count == 300) { break; } .

2021-10-07 22:20:58 396

原创 C语言网络聊天室——客户端

myhead.h#include <stdio.h>#include <unistd.h>#include <string.h>#include <time.h>#include <stdlib.h>#include <fcntl.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h>#inclu

2021-10-07 22:11:07 448

原创 C语言网络聊天室——服务器端

myhead.hextern int flag;extern struct online *head ;#include <stdio.h>#include <sys/socket.h>#include <netinet/in.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <pthread.h>#inc

2021-10-06 11:48:03 392

原创 C语言通讯录版本三:数据库的使用

myhead.h#ifndef MYHEAD_H_#define MYHEAD_H_#include <stdio.h>#include <sqlite3.h>#include <stdlib.h>#include<string.h>int create_table(sqlite3 * pdb);void insert_record(sqlite3 * pdb);void inquire_nocb(sqlite3 * pdb);vo

2021-10-06 11:41:38 120

原创 C语言通讯录版本二:从文件存取通信录信息

myhead.h#ifndef MYHEAD_H_#define MYHEAD_H_#include <stdio.h>#include <string.h>#include <stdlib.h>#define SUCCESS 1#define FAILURE 0struct hnode{ char name[20]; char age[20]; char number[20]; char telephone[

2021-10-06 11:32:28 53

原创 C语言通讯录版本一:使用链表完成

myhead.h#ifndef MYHEAD_H_#define MYHEAD_H_#include <stdio.h>#include <string.h>#include <stdlib.h>#define SUCCESS 1#define FAILURE 0struct hnode{ char name[20]; char age[20]; char number[20]; char telephone[

2021-10-06 11:29:13 94

原创 c语言网络通信客户端和服务器(udp)

客户端#include <stdio.h>#include <sys/socket.h>#include <netinet/in.h> //读写分离就要包含线程相关的头文件#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <unistd.h>#define SERVPORT 5000int main(int ar

2021-10-06 11:08:30 121

原创 C语言网络编程客户端和服务器之间的通信(tcp)

客户端#include <stdio.h>#include <sys/socket.h>#include <netinet/in.h>#include <stdlib.h>#include <string.h>#define SERVPORT 5000int main(int argc,char ** argv){ int sockfd,n; struct sockaddr_in servaddr,clia

2021-10-06 11:05:20 816 1

原创 C语言父子进程,waitpid的使用

#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <unistd.h>#include <sys/wait.h>void die(const char *msg){ perror(msg); exit(1);}void child2_do(){ printf("In.

2021-10-06 10:52:52 246

原创 C语言栈的实现

#include<stdio.h>#include<stdlib.h>#define MAX 10struct stack_data{ int stack_array[MAX]; int top;};typedef struct stack_data Stack;enum result_val{EMPTY_OK = 1000,EMPTY_NO,FULL_OK ,FULL_NO,PUSH_OK,PUSH_NO,POP_NO,POP_OK};in.

2021-10-06 10:49:58 48

原创 c语言队列的实现

#include <stdio.h>#include <stdlib.h>#define MAX_SIZE 10enum return_result{FULL_OK,FULL_NO,EMPTY_OK,EMPTY_NO,PUSH_OK};struct quece_data{ int quece[MAX_SIZE]; int top; int buttom;};typedef struct quece_data Quece;void crea.

2021-10-06 10:49:07 56

原创 C语言循环链表的实现

#include<stdio.h>#include<stdlib.h>#include<time.h>struct hnode{ int num; struct hnode * next;};typedef struct hnode Hnode;typedef Hnode * CircHlink;enum result_val{RET_OK = 1000,RET_NO};int is_malloc_ok( CircHlink ne.

2021-10-06 10:47:06 77

原创 C语言双向链表的实现

#include<stdio.h>#include<stdlib.h>#include<time.h>struct dblnode{ int num; struct dblnode * prior, * next;};typedef struct dblnode Dblnode;typedef Dblnode * Dblink;enum result_val{RET_OK = 1000,RET_NO};int is_malloc_.

2021-10-05 22:41:58 49

原创 C语言链表查找功能

#include<stdio.h>#include<stdlib.h>struct node{ int num; char name[50]; struct node * next;};typedef struct node Node; //重命名typedef Node * Link;enum result_val{RET_OK = 1,RET_NO=0}; //枚举void create_head(Link * head){ .

2021-10-05 22:40:51 393

原创 C语言链表逆序

#include<stdio.h>#include<stdlib.h>#include<time.h>struct node{ int num; struct node * next;};typedef struct node Node;typedef Node * Link;enum result_val{RET_OK = 1000,RET_NO};void create_head(Link * head){ *he.

2021-10-05 22:40:08 87

原创 C语言求链表长度

#include<stdio.h>#include<stdlib.h>#include<time.h>struct node{ int num; struct node * next;};typedef struct node Node; //重命名typedef Node * Link;enum result_val{RET_OK = 1,RET_NO=0}; //枚举void create_head(Link * head).

2021-10-05 22:38:56 2620

原创 C语言带表头链表的使用,头尾中插,显示,删除,查找,逆序等功能的实现

#include<stdio.h>#include<stdlib.h>#include<time.h>struct hnode{ int num; struct hnode * next;};typedef struct hnode Hnode;typedef Hnode * Hlink;enum result_val{RET_OK = 1000,RET_NO};int is_malloc_ok(Hlink new_node){.

2021-10-05 22:36:18 122

原创 c语言不带表头的链表的使用

#include<stdio.h>#include<stdlib.h>struct node{ int num; struct node * next;};typedef struct node Node; //重命名typedef Node * Link;enum result_val{RET_OK = 1,RET_NO=0}; //枚举void create_head(Link * head){ *head = NULL;}.

2021-10-05 22:33:41 62

原创 C语言数据库sqlite3的基本操作(使用回调函数和不使用回调函数)

#include <stdio.h>#include <sqlite3.h>#include <stdlib.h>int create_table(sqlite3 * pdb){ char * errmsg = NULL; char * sql; int ret; sql = "create table if not exists mytable (id integer primary key,name text);"; ret = .

2021-10-05 22:31:03 507

原创 C语言文件复制(库函数版本)

#include<stdio.h>#include<stdlib.h>int main(){ FILE *fp; FILE *pf; char ch; if((fp=fopen("tt.c","rt"))==NULL) { printf("\nCannot open file strike any key exit!"); getchar(); exit(1); } if((pf=fope.

2021-10-05 22:27:54 120

原创 C语言文件复制操作read和write使用

#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <errno.h>#include <stdlib.h>#include <string.h>#define BUFFER_SIZE 1024int main(int argc,.

2021-10-05 22:26:15 333

C++.zip,本人学习C++的部分代码

未整理,按照学习的日期分类

2021-10-07

c语言练习.zip,包含C语言基本知识的代码

C语言基本的算法练习题,数据结构,数据库,网络通信,管道信号等练习代码,存在部分错误

2021-10-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除