diff --git a/LinkQueue/Debug/LinkQueue.log b/LinkQueue/Debug/LinkQueue.log new file mode 100644 index 0000000..6ee36c0 --- /dev/null +++ b/LinkQueue/Debug/LinkQueue.log @@ -0,0 +1,14 @@ +生成启动时间为 2017/2/28 21:58:35。 + 1>项目“E:\wd\数据结构\数据结构code\my code\LinkQueue\LinkQueue\LinkQueue.vcxproj”在节点 2 上(Build 个目标)。 + 1>ClCompile: + C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Debug\LinkQueue.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt LinkQueue.cpp + LinkQueue.cpp + Link: + C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"E:\wd\数据结构\数据结构code\my code\LinkQueue\Debug\LinkQueue.exe" /INCREMENTAL /NOLOGO opencv_ml249d.lib opencv_calib3d249d.lib opencv_contrib249d.lib opencv_core249d.lib opencv_features2d249d.lib opencv_flann249d.lib opencv_gpu249d.lib opencv_highgui249d.lib opencv_imgproc249d.lib opencv_legacy249d.lib opencv_objdetect249d.lib opencv_ts249d.lib opencv_video249d.lib opencv_nonfree249d.lib opencv_ocl249d.lib opencv_photo249d.lib opencv_stitching249d.lib opencv_superres249d.lib opencv_videostab249d.lib opencv_objdetect249.lib opencv_ts249.lib opencv_video249.lib opencv_nonfree249.lib opencv_ocl249.lib opencv_photo249.lib opencv_stitching249.lib opencv_superres249.lib opencv_videostab249.lib opencv_calib3d249.lib opencv_contrib249.lib opencv_core249.lib opencv_features2d249.lib opencv_flann249.lib opencv_gpu249.lib opencv_highgui249.lib opencv_imgproc249.lib opencv_legacy249.lib opencv_ml249.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"E:\wd\数据结构\数据结构code\my code\LinkQueue\Debug\LinkQueue.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"E:\wd\数据结构\数据结构code\my code\LinkQueue\Debug\LinkQueue.lib" /MACHINE:X86 Debug\LinkQueue.obj + Debug\stdafx.obj + LinkQueue.vcxproj -> E:\wd\数据结构\数据结构code\my code\LinkQueue\Debug\LinkQueue.exe + 1>已完成生成项目“E:\wd\数据结构\数据结构code\my code\LinkQueue\LinkQueue\LinkQueue.vcxproj”(Build 个目标)的操作。 + +生成成功。 + +已用时间 00:00:01.03 diff --git a/LinkQueue/Debug/LinkQueue.obj b/LinkQueue/Debug/LinkQueue.obj new file mode 100644 index 0000000..4bcb607 Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.obj differ diff --git a/LinkQueue/Debug/LinkQueue.pch b/LinkQueue/Debug/LinkQueue.pch new file mode 100644 index 0000000..60dd536 Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.pch differ diff --git a/LinkQueue/Debug/LinkQueue.tlog/CL.read.1.tlog b/LinkQueue/Debug/LinkQueue.tlog/CL.read.1.tlog new file mode 100644 index 0000000..6020084 Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.tlog/CL.read.1.tlog differ diff --git a/LinkQueue/Debug/LinkQueue.tlog/CL.write.1.tlog b/LinkQueue/Debug/LinkQueue.tlog/CL.write.1.tlog new file mode 100644 index 0000000..c7eb16d Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.tlog/CL.write.1.tlog differ diff --git a/LinkQueue/Debug/LinkQueue.tlog/LinkQueue.lastbuildstate b/LinkQueue/Debug/LinkQueue.tlog/LinkQueue.lastbuildstate new file mode 100644 index 0000000..d080aa8 --- /dev/null +++ b/LinkQueue/Debug/LinkQueue.tlog/LinkQueue.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit +Debug|Win32|E:\wd\数据结构\数据结构code\my code\LinkQueue\| diff --git a/LinkQueue/Debug/LinkQueue.tlog/cl.command.1.tlog b/LinkQueue/Debug/LinkQueue.tlog/cl.command.1.tlog new file mode 100644 index 0000000..d875e6a Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.tlog/cl.command.1.tlog differ diff --git a/LinkQueue/Debug/LinkQueue.tlog/link.command.1.tlog b/LinkQueue/Debug/LinkQueue.tlog/link.command.1.tlog new file mode 100644 index 0000000..fc231cf Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.tlog/link.command.1.tlog differ diff --git a/LinkQueue/Debug/LinkQueue.tlog/link.read.1.tlog b/LinkQueue/Debug/LinkQueue.tlog/link.read.1.tlog new file mode 100644 index 0000000..6413db5 Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.tlog/link.read.1.tlog differ diff --git a/LinkQueue/Debug/LinkQueue.tlog/link.write.1.tlog b/LinkQueue/Debug/LinkQueue.tlog/link.write.1.tlog new file mode 100644 index 0000000..5ce36b3 Binary files /dev/null and b/LinkQueue/Debug/LinkQueue.tlog/link.write.1.tlog differ diff --git a/LinkQueue/Debug/stdafx.obj b/LinkQueue/Debug/stdafx.obj new file mode 100644 index 0000000..64e788d Binary files /dev/null and b/LinkQueue/Debug/stdafx.obj differ diff --git a/LinkQueue/Debug/vc120.idb b/LinkQueue/Debug/vc120.idb new file mode 100644 index 0000000..1fa7850 Binary files /dev/null and b/LinkQueue/Debug/vc120.idb differ diff --git a/LinkQueue/Debug/vc120.pdb b/LinkQueue/Debug/vc120.pdb new file mode 100644 index 0000000..27bf19b Binary files /dev/null and b/LinkQueue/Debug/vc120.pdb differ diff --git a/LinkQueue/LinkQueue.cpp b/LinkQueue/LinkQueue.cpp new file mode 100644 index 0000000..5a11b3e --- /dev/null +++ b/LinkQueue/LinkQueue.cpp @@ -0,0 +1,23 @@ +// LinkQueue.cpp : ̨Ӧóڵ㡣 +// + +#include "stdafx.h" +#include"LinkQueue.h" +#include +using namespace std; + +int _tmain(int argc, _TCHAR* argv[]) +{ + string s1("wd"); + LinkQueue queue; + queue.EnQueue(s1); + queue.EnQueue("ustc"); + queue.EnQueue("ahu"); + queue.Print(); + queue.DeQueue(); + queue.Print(); + string a=queue.GetQueueHead(); + + return 0; +} + diff --git a/LinkQueue/LinkQueue.h b/LinkQueue/LinkQueue.h new file mode 100644 index 0000000..f32f376 --- /dev/null +++ b/LinkQueue/LinkQueue.h @@ -0,0 +1,132 @@ +#pragma once +#include +#include +#include +using namespace std; + +//Զ쳣 +class LinkQueueException : public exception //רṩⲿʹõģڲ +{ +public: + LinkQueueException(string msg) : m_msg(msg) {} + const char * what() const throw () // + { + return m_msg.c_str(); + } +private: + string m_msg; +}; + +// +template +class LinkQueue +{ +public: + LinkQueue(); //޲ι + LinkQueue(T initValue); //вҹ + ~LinkQueue(); + void EnQueue(T e); // + void DeQueue(); // + int GetSize(); //ȡг + T GetQueueHead(); //ȡͷ + void Print(); // + void ClearQueue(); //ն +private: + void InitQueue(); //ʼ + bool IsEmpty(); //ǷΪ + +private: //NodeΪڲ࣬ⲿ + class Node //ڵ + { + public: + Node(T d, Node* n = nullptr) : data(d), next(n) {} + private: + T data; + Node* next; + friend class LinkQueue; //ԱΪ˽УôֻԪܷ + }; +private: + Node* m_front; //ͷڵ㣬ָ + Node* m_rear; //βڵ㣬ָβ + int m_count; //дС + T m_initVlaue="0"; //ʼڵֵ +}; + +//캯 +template +LinkQueue::LinkQueue() +{ + InitQueue(); +} +//ʼ +template +void LinkQueue::InitQueue() +{ + m_front = new Node(m_initVlaue); + m_rear = new Node(m_initVlaue); + m_count = 0; +} +//вι캯 +template +void LinkQueue::LinkQueue(T initValue) +{ + m_initVlaue = initValue; + InitQueue(); +} +// +template +LinkQueue::~LinkQueue() +{ + ClearQueue(); +} +//ն +template +void LinkQueue::ClearQueue() +{ + delete m_front; + m_front = nullptr; + delete m_rear; + m_rear = nullptr; +} +// +template +void LinkQueue::EnQueue(T e) +{ + Node* node = new Node(m_initValue); + node->data = e; + if (IsEmpty()) + m_rear->next = node; + else + m_rear->next->next = node; + m_rear->next = node; + node->next = nullptr; + ++m_count; +} +// +template +void LinkQueue::DeQueue() +{ + if (IsEmpty()) + { + //cout << "ӿգʧ" << endl; + throw LinkQueueException("ӿգʧ"); + } + Node* temp = m_front->next; + m_front->next = temp->next; + deleta temp; + --m_count; +} +//ȡг +template +T LinkQueue::GetSize() +{ + return m_count; +} + +template +T LinkQueue::GetQueueHead() +{ + if (IsEmpty()) + throw LinkQueueException("ӿգ޷ͷڵ"); + +} \ No newline at end of file diff --git a/LinkQueue/LinkQueue.vcxproj b/LinkQueue/LinkQueue.vcxproj new file mode 100644 index 0000000..163dfcd --- /dev/null +++ b/LinkQueue/LinkQueue.vcxproj @@ -0,0 +1,96 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D92C17FB-5C51-46A2-8930-8E344EEB45AF} + Win32Proj + LinkQueue + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/LinkQueue/LinkQueue.vcxproj.filters b/LinkQueue/LinkQueue.vcxproj.filters new file mode 100644 index 0000000..c689c8f --- /dev/null +++ b/LinkQueue/LinkQueue.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + 头文件 + + + 头文件 + + + 头文件 + + + + + 源文件 + + + 源文件 + + + \ No newline at end of file diff --git a/LinkQueue/ReadMe.txt b/LinkQueue/ReadMe.txt new file mode 100644 index 0000000..e2d8300 --- /dev/null +++ b/LinkQueue/ReadMe.txt @@ -0,0 +1,30 @@ +======================================================================== + 控制台应用程序:LinkQueue 项目概述 +======================================================================== + +应用程序向导已为您创建了此 LinkQueue 应用程序。 + +本文件概要介绍组成 LinkQueue 应用程序的每个文件的内容。 + + +LinkQueue.vcxproj + 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 + +LinkQueue.vcxproj.filters + 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 + +LinkQueue.cpp + 这是主应用程序源文件。 + +///////////////////////////////////////////////////////////////////////////// +其他标准文件: + +StdAfx.h, StdAfx.cpp + 这些文件用于生成名为 LinkQueue.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 + +///////////////////////////////////////////////////////////////////////////// +其他注释: + +应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 + +///////////////////////////////////////////////////////////////////////////// diff --git a/LinkQueue/stdafx.cpp b/LinkQueue/stdafx.cpp new file mode 100644 index 0000000..0679a10 --- /dev/null +++ b/LinkQueue/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : ֻ׼ļԴļ +// LinkQueue.pch ΪԤͷ +// stdafx.obj ԤϢ + +#include "stdafx.h" + +// TODO: STDAFX.H +// κĸͷļڴļ diff --git a/LinkQueue/stdafx.h b/LinkQueue/stdafx.h new file mode 100644 index 0000000..97ac785 --- /dev/null +++ b/LinkQueue/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : ׼ϵͳļİļ +// Ǿʹõĵ +// ضĿİļ +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: ڴ˴óҪͷļ diff --git a/LinkQueue/targetver.h b/LinkQueue/targetver.h new file mode 100644 index 0000000..aadba2f --- /dev/null +++ b/LinkQueue/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// SDKDDKVer.h õ߰汾 Windows ƽ̨ + +// ҪΪǰ Windows ƽ̨Ӧó WinSDKVer.h +// WIN32_WINNT ΪҪֵ֧ƽ̨Ȼٰ SDKDDKVer.h + +#include