自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 观察者模式

#include<iostream> #include<list> #include<string> using namespace std; class Subject; class Observer { public: Observer() {} virtual ~Observer() {} virtual void update(Subject* subject) = 0; virtual void update(string content) = .

2020-11-16 20:30:57 176

原创 C/C++编程题刷题:质数对的个数

#include<iostream> using namespace std; bool isPrime(int n) { for (int i = 2; i < n; i++) { if (n%i == 0) return false; } return true; } int main() { int n; cin >> n; int cnt = 0; for (int i = 2; i < n; i++) { if (isPrime(i.

2020-11-07 00:16:54 351

原创 C/C++编程题刷题:多线程交替打印ABC

#include<thread> #include<iostream> #include<mutex> #include<vector> #include<condition_variable> using namespace std; mutex mtx; condition_variable cond; char s[] = { 'A','B','C' }; char message = 'A'; void handler(int i) .

2020-11-07 00:15:34 457

原创 Mymemmove_memcpy类

#include<iostream> using namespace std; void* mymemcpy(void *dst, const void *src, size_t size) { if (dst == NULL || src == NULL) return NULL; char* psrc; char* pdst; psrc = (char*)src; pdst = (char*)dst; while (size--) { *pdst++ = *psrc+..

2020-11-07 00:08:28 134

原创 MyStringcopy类

#include<iostream> #include<assert.h> using namespace std; int mystrlen(const char* src) { assert(src != NULL); const char* head = src; while (*src != '\0') src++; return (src - head - 1); } char * mystrcopy(char * src, char* dst) { if ..

2020-11-07 00:07:23 124

原创 MyString类

#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<string> using namespace std; class MyString { public: MyString(); MyString(const char* const p); MyString(const MyString & s); ~MyString(); MyString& operator = (const ..

2020-11-07 00:05:48 280

原创

#include<iostream> using namespace std; class MyStack { public: MyStack(int cap) { capacity = cap; Bottom = 0; Top = 0; size = 0; pStack = new int[capacity]; } MyStack() { capacity = 5; Bottom = 0; Top = 0; size = 0; pStack =.

2020-11-07 00:04:25 75

原创 循环队列

#include<iostream> using namespace std; class cycleQueue { private: int *cycleQueueHead; int front; int rear; int size; void resize() { int *temp = new int[size * 2]; int j = 0; for (int i = front; i != rear; i = (i + 1) % size) { tem.

2020-11-07 00:03:37 97

原创 C/C++编程题刷题:topK快排和堆排序的解决方案

#include<iostream> #include<vector> #include<deque> using namespace std; #define random(x) (rand()%x) bool isAsc = false; //堆调整 void HeapAdjust(vector<int> &nums, int index, int n) { int leftChild = 2 * index + 1; int righC.

2020-11-06 20:35:24 214

空空如也

空空如也

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

TA关注的人

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