原创 c++單例模式(線程安全)

1.構造函數爲private,生成對象的時候,編譯器調用構造函數屬於外部調用。 2.構造函數爲private不能被繼承,因爲當其子類初始化的時候需要調用構造函數,但此時構造函數爲private,不能被調用。 所以,該類只有一個實例。 空間

原创 c++類適配器

// ConsoleApplication1.cpp : Defines the entry point for the console appli

原创 鏈表逆置

#include<iostream> using namespace std; struct Node {int data;Node *next;

原创 c++簡單工廠模式

// ConsoleApplication1.cpp : Defines the entry point for the console appli

原创 約瑟夫環輸出出隊的人的序號,數組模擬

#include <stdio.h> #include <stdlib.h>  int peoples[100];   int main(void) {     int people_count = 0;     printf("請輸入

原创 單鏈表的一些操作

#include<iostream> using namespace std; typedef char elemtype;//以char型爲例 struct Node { elemtype data; Node *next;

原创 c++抽象工廠模式

// ConsoleApplication1.cpp : Defines the entry point for the console appli

原创 二叉樹入門(對稱二叉樹)

對稱二叉樹 Problem Description 如果二叉樹的左右子樹的結構是對稱的,即兩棵子樹皆爲空,或者皆不空,則稱該二叉樹是對稱的。判斷給定的二叉樹是否對稱。二叉樹用層序結構給出,若讀到#則爲空,如果二叉樹是對稱的,輸出“Yes”

原创 c++建造者模式

// ConsoleApplication1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <ios

原创 無名

人生是個什麼東西

原创 c++橋接模式

#include "stdafx.h" #include <iostream> using namespace std; class SoftWare { public: virtual void display() = 0; };

原创 c++對象適配器

// ConsoleApplication1.cpp : Defines the entry point for the console application. // #include "stdafx.

原创 c++外觀模式

#include "stdafx.h" #include <iostream> using namespace std; class FunA { public: void display() {cout<<"FunA is wor

原创 c++原型模式

#include "stdafx.h" #include <iostream> using namespace std; class Prototype { public:virtual Prototype* clone() cons

原创 使用olldbg從入門到精通之splish註冊機代碼

// ConsoleApplication20.cpp : 定義控制檯應用程序的入口點。 // #include "stdafx.h" #include <iostream> #include <stri