自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(89)
  • 收藏
  • 关注

原创 设计模式 四

观察者模式#include <iostream>#include <list>#include <string>using namespace std;class Observer;class AbsSecretary{public: virtual void add(Observer *o) = 0; virtual void remo...

2019-01-29 10:44:54 147

原创 设计模式 三

组合模式#include <iostream>#include <list>#include <string>using namespace std;class IFile{public: virtual ~IFile() {} virtual void remove(IFile *) = 0; virtual void addFile(...

2019-01-28 19:21:15 131

原创 设计模式 二

#include <iostream>#include <thread>#include <mutex>#include <vector>using namespace std;class Sigleton{public: static Sigleton *GetInstance() { if (m_intance == n...

2019-01-27 15:11:30 171

原创 设计模式 一

#include <iostream>using namespace std;class Bankworker{public: virtual void work() = 0;};class Bankworker_Save:public Bankworker{public: void work() { cout << "存钱" << ...

2019-01-26 18:22:19 169

原创 STL 七

#include <iostream>using namespace std;void func3(){ cout << "进入 3---------------" << endl; throw 1.2; cout << "离开 3---------------" << endl;}void func2()

2019-01-25 20:35:58 132

原创 STL 六

#include <iostream>using namespace std;void func1(){ int a = 10; int *pa = (int*)a; char c = 'a'; double d = 1.2; a = (int)d; a = static_cast<int>(d); pa = reinterpret_cast&lt...

2019-01-25 20:34:06 140

原创 STL 五

#include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;bool greater3(int a){ return a>3;}class Div{public: Div(int...

2019-01-23 20:24:11 111

原创 STL 四

#include <iostream>#include <string>#include <algorithm>#include <functional>#include <vector>using namespace std;void func(){ plus <int> add; cout...

2019-01-22 18:35:47 133

原创 STL 三

#include <iostream>#include <string>#include <algorithm>#include <vector>#include <time.h>using namespace std;void print(vector <int> &v){ vector&

2019-01-22 18:34:12 232

原创 STL 二

#include <iostream>#include <string>#include <set>using namespace std;void print(const set<int> &s){ set<int>::iterator it =s.begin(); while (it != s.en...

2019-01-20 22:46:57 130

原创 STL 一

#include <iostream>#include <string>#include <deque>#include <list>using namespace std;void print(deque <int> &d){ deque<int> :: iterator it = d.begi...

2019-01-20 22:46:12 153

原创 c++ 十

#include <iostream>#include <string>using namespace std;class Sharp{public: virtual double area() = 0;};class Circl:public Sharp{public: Circl(int r) { this-&...

2019-01-18 18:47:21 385

原创 c++ 九

#include <iostream>#include <string>using namespace std;class Parent1{public: void init(int a,int b) { this->a = a; this->b = b; } void s

2019-01-17 18:57:21 219

原创 c++ 八

#include <iostream>#include <string>//继承using namespace std;class Animal{public: void eatf() { cout << "吃饭"<<endl; } void sleepj() { c...

2019-01-16 09:36:59 214

原创 c++ 七

#include <iostream>#include <string>using namespace std;int main(){ string s[100]; int num; cin >> num; for(int i = 0 ; i < num; i++) cin >> s[i...

2019-01-16 09:34:52 291

原创 c++ 七

#include <iostream>using namespace std;class Complex{ friend Complex &operator ++(Complex &c);public: Complex(int a = 0,int b = 0) { m_a = a; m_b = b; ...

2019-01-14 19:23:40 180

原创 c++ 六

#include <iostream>using namespace std;class Student{public: Student (int a) { m_a = a; } Student (const Student &obj) { m_a = obj.m_a; cout ...

2019-01-13 19:18:38 186

原创 c++ 五

#include <iostream>using namespace std;class Student{public: void init(int id,const char *name); int getId(); const char *getName();private: int m_id; const char *m_na...

2019-01-13 19:15:47 142

原创 c++ 四

#include <iostream>using namespace std;class Student{public: Student (int a) { m_a = a; } Student (const Student &obj) { m_a = obj.m_a; cout ...

2019-01-11 19:19:01 159

原创 c++ 三

#include <iostream>using namespace std;class Test{public: Test(int a,int b):m_a(a),m_b(b) { cout << "构造:m_a = " << m_a << ",m_b = " << m_b &l

2019-01-11 19:10:15 127

原创 c++ 二

#include <iostream>using namespace std;struct Student{ int id; char name[100];};void prints(Student *pa){ printf("id = %d,name = %s\n",pa->id,pa->name);}void prints(St...

2019-01-09 18:52:32 177

原创 c++ 一

#include <stdio.h>int main(int argc, char *argv[]){ printf("Hello World!\n"); int i; for(i = 0; i < argc; i++) { printf("%s\n",argv[i]); } getchar(); r...

2019-01-09 18:50:28 111

原创 网络编程 六

数据库查询2#include <stdio.h>#include <sqlite3.h>int main(){ sqlite3 *db; int ret = sqlite3_open("student.db",&db); if (ret != SQLITE_OK) { printf ("数据库打开失败\n"); return -1; }...

2019-01-09 18:46:01 107

原创 网络编程 五

数据库查询2#include <stdio.h>#include <sqlite3.h>// 回调函数执行方式:没查询到一条记录调用一次回调函数// 第一个参数:exec 用户传过来的参数// 第二个参数:查询到的结果的 列数// 第三个参数:查询的一条记录的值, 例如 char *value[] = {"1", "zhang", "M", "18...

2019-01-05 09:45:09 94

原创 网络编程 四

数据库查询1#include <stdio.h>#include <sqlite3.h>// 回调函数执行方式:没查询到一条记录调用一次回调函数// 第一个参数:exec 用户传过来的参数// 第二个参数:查询到的结果的 列数// 第三个参数:查询的一条记录的值, 例如 char *value[] = {"1", "zhang", "M", "18...

2019-01-05 09:44:03 183

原创 网络编程 三

数据库操作#include <stdio.h>#include <sqlite3.h>int main(){ sqlite3 *db; int ret = sqlite3_open("student.db",&db); if (ret != SQLITE_OK) { printf ("数据库打开失败\n"); return -1; } ...

2019-01-03 18:14:10 99

原创 网络编程 二

udpudp服务器#include <stdio.h>#include <sys/types.h> /* See NOTES */#include <sys/socket.h>#include <arpa/inet.h>#include <string.h>#include <unistd.h>...

2019-01-03 18:12:54 87

原创 网络编程 一

#include <stdio.h>#include <sys/types.h> /* See NOTES */#include <sys/socket.h>#include <arpa/inet.h>#include <string.h>#include <unistd.h>#define ...

2019-01-01 22:22:12 75

原创 系统编程 十一

1、线程什么是线程线程是进程的一个实体,是CPU调度和分派的基本单位,他是比进程更小的能独立运行的基本单位。线程自己基本上不拥有系统资源,只拥有一点在运行中必不可少的资源(如程序计数器,一组寄存器和栈),但是它可与同属于一个进程的其他的线程共享进程拥有的全部资源。进程与线程Linux进程创建一个新线程,线程将拥有自己的栈(因为线程有自己的局部变量),但与他的创建者共享全局变量、文件描述符、...

2018-12-31 20:32:23 125

原创 系统编程 十

1、管道通信管道包括无名管道和有名管道两种,前者用于父进程和子进程间的通信,后者可用于运行于同一系统中的任意两个进程间的通信。无名管道由pipe()函数创建:int pipe(int filedis[2]);当一个管道建立时,它会创建两个文件描述符:filedis[0]用于读管道,filedis[1]用于写管道。管道通信管道用于不同进程间通信。通常先创建一个管道,在通过fork函数...

2018-12-31 20:27:16 111

原创 系统编程 九

生产者和消费者.c#include <stdio.h>#include <pthread.h>#include <stdlib.h>#include <semaphore.h>#include <string.h>struct _msg{ char buf[20]; sem_t full;//生产者 sem_t emp...

2018-12-28 18:18:29 111

原创 系统编程 八

线程创建线程.c#include <stdio.h>#include <pthread.h>#include <stdlib.h>void *worker(void *k){ long num = (long)k; while(1) { printf("子线程:%ld\n",num ); sleep(1); }}int ...

2018-12-27 18:51:13 89

原创 系统编程 七

消息队列数据发送.c#include <stdio.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/msg.h>#include <stdlib.h>#include <string.h>struct msgbuf{ long mtyp...

2018-12-26 21:43:53 79

原创 系统编程 六

共享内存Msg.h文件#ifndef _MSG_H#define _MSG_H#include <stdio.h>#include <sys/ipc.h>#include <sys/shm.h>#include <sys/types.h>#include <stdlib.h>#include <string.h...

2018-12-25 18:42:42 102

原创 系统编程 五

fputc#include <stdio.h>#include <unistd.h>#include <stdlib.h>int main(int argc, char const *argv[]){ FILE *fp1 = fopen (argv[1],"r"); FILE *fp2 = fopen (argv[2],"w"); if (N...

2018-12-24 18:58:49 122

原创 系统编程 四

fgetc#include <stdio.h>#include <stdlib.h>int main(int argc, char const *argv[]){ FILE *fp = fopen("1.ppt","r"); FILE *fp1 = fopen("3.ppt","w"); if(NULL == fp || NULL == fp1) {

2018-12-24 18:56:48 95

原创 系统编程 三

用文件编写的通讯录Contc.h文件#ifndef _CONTC_H_#define _CONTC_H_#define DEM 10#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct _node{ char id[200]; char phone[...

2018-12-22 16:52:10 108

原创 系统编程 二

文件操作#include <stdio.h>#define SIZE 1024int main(){ FILE *fp1 = fopen("1.ppt", "r"); FILE *fp2 = fopen("2.ppt", "w"); if (NULL == fp1 || NULL == fp2) { perror("打开文件失败"); return -1

2018-12-22 16:49:11 96

原创 系统编程 一

open#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdlib.h>#include <errno.h>int main(int argc, char const *argv...

2018-12-20 20:07:36 152

原创 数据结构 十二

要求将下列名单随机分组:分组要求,随机选择4个人组成一组输出结果:4个人一行进行输出,每行代表一个组人名:曾从威 蒋恺均 刘江涛 崔雅倩 祝秋培 吴赟鹏 李鸿飞 王 虎 缪 峰 张 龙刘加封 姚 笛 郑 丹 孔海宇 陈逸伦 徐煜清 陈 喆 盛 开 方文倩 边金鹏 陈振宇 陶小康 孙凌霄 王玉恒 王娇娇 许新华 胡光兴 周 波 王 鹏...

2018-12-19 19:41:16 145

空空如也

空空如也

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

TA关注的人

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