摘要: 源文:http://blog.csdn.net/monzart/article/details/6030999解决办法菜单--〉项目--〉设置,出现“项目设置”对话框,左边展开项目,在“源文件”中找到出错的文件,然后在右边选择“C/C++”属性页,在Category下拉框中选择“Precompiled Headers”,然后在下面选择“Not using precompiled headers”,重新编译一般就没问题了。注意.C 文件不能包含stdafx.h头文件,必须要去掉预编译头。VS2005直接在解决方案资源管理器中右击文件,选择属性,配置属性->c++->预编译头右侧的创建 阅读全文
posted @ 2013-04-16 11:08 uniquews 阅读(9044) 评论(0) 推荐(0) 编辑
摘要: 看似很简单的基础知识,学不扎实就会很麻烦,很多这样的基础知识堆积到一起,就会变成大麻烦。花了相当一段时间才搞明白这个问题网上看了很多人的分析,想要搞明白还得自己动手写写:解释都在代码里: 1 #include <iostream> 2 3 using namespace std; 4 5 6 /* 7 值一样,但是含义不一样,做运算过后结果自然不一样。 8 */ 9 10 int main()11 {12 int a[5] = {1,2,3,4,5};13 //(int *)(&a+1): 则是把上一步计算出来的地址,强制转换为int * 类型,赋值给ptr。14... 阅读全文
posted @ 2013-01-14 15:18 uniquews 阅读(3518) 评论(1) 推荐(0) 编辑
摘要: LinearMap就是普通的数组。HashMap是自己做的哈希映射。HashMap查找的时间复杂度为O(1),十分快。二叉查找树的查找速度是O(LogN),所以哈希在查找数据时表现很好。但是,Hash并不适合做排序,而二叉查找树中和了查找和排序两个功能。Hash_Map 1 #include <vector> 2 3 template <class Key, class Value> 4 class HashMap //哈希映射 5 6 { 7 public: 8 HashMap(int size = 101):arr(size){ 9 10 currentSiz... 阅读全文
posted @ 2013-01-14 01:48 uniquews 阅读(430) 评论(0) 推荐(0) 编辑
摘要: 这个代码还是有些问题,应该出在了堆头文件的保护#ifdef上。大顶堆: 1 #ifdef _MAXHEAP_H_ 2 #define _MAXHEAP_H_ 3 4 template <class T> 5 class MaxHeap 6 { 7 8 public: 9 MaxHeap(int mx = 10); 10 virtual ~MaxHeap(); 11 12 bool IsEmpty(); 13 void Push(const T&); 14 void Pop(); 15 const T& Top() cons... 阅读全文
posted @ 2013-01-12 23:55 uniquews 阅读(335) 评论(0) 推荐(0) 编辑
摘要: VS2010与Matlab2010b混合编程 套用今天的签名“最新的VS+最新的MATLAB+最新的WINDOWS=无尽的烦恼”,用了一天的时间去配置相关的环境,确实很囧。好在现在问题解决了,特发布过程如下,希望能给有需要的朋友带来帮助。注:因为程序也是刚调通,所以有些原因还没有仔细分析,如果不对,敬请指教。1.<MATLAB>表示MATLAB按照目录2. 配置过程中的错误,请见:附录3.文中包含"只针对64位WINDOWS"字眼设置的,在WIN32(X86)环境无需设置4.本文配置中可能包含多余的一些配置,不过现在的目的是运行成功哈~~~至于精简部分,待我和大 阅读全文
posted @ 2012-12-27 16:20 uniquews 阅读(17863) 评论(7) 推荐(1) 编辑
摘要: 将输入内容放入流中,并返回。1 #ifndef _GET_H2 #define _GET_H3 4 #include <iostream>5 6 std::istream& get(std::istream& in);7 8 9 #endif 1 #include "get.h" 2 3 std::istream& get(std::istream& in) 4 { 5 6 int ival; 7 8 while(in >> ival, !in.eof()) 9 {10 11 if(in.bad())12 throw. 阅读全文
posted @ 2012-12-23 16:31 uniquews 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <fstream> 3 #include <string> 4 #include <vector> 5 6 using namespace std; 7 8 void process(string s) 9 {10 11 cout << s << endl;12 }13 14 int main()15 16 {17 vector <string> files;18 files.push_back("one.txt");19 f 阅读全文
posted @ 2012-12-23 11:43 uniquews 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include<fstream> 3 #include<string> 4 5 using namespace std; 6 7 int main() 8 9 {10 ofstream outfile("test.txt");//创建新的文件11 outfile << "hello file!";//这些文字进入到流中,这个流被写道文件里12 outfile.close();//把这个文件关闭了13 14 15 string file("one.t 阅读全文
posted @ 2012-12-23 11:16 uniquews 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 #include <ctime> 5 6 using namespace std; 7 using std::vector; 8 9 struct ArcBox 10 { 11 int headvex,tailvex; 12 ArcBox *hlink,*tlink; 13 float weight; 14 }; 15 16 17 template <class TElemTyp... 阅读全文
posted @ 2012-12-18 21:10 uniquews 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 1 #ifndef 二叉查找树_H 2 #define 二叉查找树_H 3 4 #include <iostream> 5 6 //using namespace std; 头文件里不要这样写 7 8 enum Boolean {FALSE, TRUE};//自己做一个boolean 9 10 template<class Type> 11 class Element 12 { 13 public: 14 Type key; 15 //添加更多的数据较容易 16 }; 17 18 template <class Type> class B... 阅读全文
posted @ 2012-12-17 15:00 uniquews 阅读(180) 评论(0) 推荐(0) 编辑