C/C++
sosidami
这个作者很懒,什么都没留下…
展开
-
STL中的Map(缩略)
1、map简介 map维护的是最大堆,最小堆得结构,增加和删除节点对迭代器的影响很小。对于迭代器来说,可以修改实值,而不能修改key。 2、map的功能std:map personnel;这样就定义了一个用int作为索引,并拥有相关联的指向string的指针. 3在map中插入元素 尽量使用这种插入结构:Map.insert(map :: value_type("原创 2009-11-05 21:42:00 · 804 阅读 · 0 评论 -
VS2003 试图运行项目时出错,无法启动调试。没有正确安装调试器。请运行安装程序安装或修复调试器。
运行C:/Program Files/Common Files/Microsoft Shared/VS7Debug下面的mdm.exe /regserver以上运行的命令都是在visual studio .net 命令提示符中输入,并且要进入到上面所说的目录执行才有效。大部分问题都是因为,mdm被损坏了导致的,重新运行最后一条命令就行了。转载 2010-04-28 16:52:00 · 768 阅读 · 2 评论 -
STL set 容易引起误解的一个地方
STL set 容易引起误解的一个地方#include #include #include using namespace std;using std::set;using std::string; struct student { string name; int grade; student(str原创 2010-04-27 12:29:00 · 1742 阅读 · 0 评论 -
STL SET
STL SETSetSets are a kind ofassociative containers that stores unique elements, and in which the elementsthemselves are the keys.Associative containers are containers especially designed原创 2010-04-27 12:27:00 · 2255 阅读 · 0 评论 -
sprintf的用法
sprintf的功能:将各种类型的数据构造成字符串sprintf 是个变参函数,定义如下:int sprintf( char *buffer, const char *format [, argument] ... );//把整数123 打印成一个字符串保存在s 中。sprintf(s, "%d", 123); //产生"123"可以指定宽度,不足的左边补空格:sprintf(s, "%8d%转载 2010-01-05 09:44:00 · 1805 阅读 · 1 评论 -
程序的四种入口方式
程序的四种入口方式 UNICODE Windows : wWinMainCRTStartup UNICODE Console : wmainCRTStartup (如果转换会MBCS,若编译错误,则指定入口)非 UNICODE Windows: WinMainCRTStartup 非 UNICODE Console: mainCRTStartup所以会出现如下的链转载 2010-03-13 17:27:00 · 1708 阅读 · 0 评论 -
C++ Templates笔记 7 非类型模板参数
#include #include #include #include #include //std::vector 是CONT的缺省值(缺省模板实参)template >class Stack {private: CONT elems; // elementspublic: void push(T const&);原创 2009-12-30 15:03:00 · 591 阅读 · 0 评论 -
C++ Templates笔记 6 缺省模板实参
#include #include #include #include #include //std::vector 是CONT的缺省值(缺省模板实参)template >class Stack {private: CONT elems; // elementspublic: void push(T const&);原创 2009-12-30 14:10:00 · 565 阅读 · 0 评论 -
C++ Templates笔记 4 类模板Stack
#include #include #include #include #include template class Stack {private: std::vector elems; // elementspublic: void push(T const&); // push element void pop();原创 2009-12-30 13:39:00 · 486 阅读 · 0 评论 -
C++ Templates笔记 3 重载函数模板(附加)
#include #include #include // maximum of two values of any typetemplate inline T const& max (T const& a, T const& b){ return a < b ? b : a;}// maximum of two pointerstemplat原创 2009-12-30 09:54:00 · 648 阅读 · 0 评论 -
C++ Templates笔记 1
/*可以使用任何类型来实例化该类型的参数,只要所使用的类型提供模板使用的操作即可 鉴于历史原因,你可以使用class来代替typename,来定义类型参数。在C++语言的演化过程中typename出现的相对较晚一些,在它之前,关键字classs是引入类型参数的唯一方式,并一直作为有效方式保留下来。 从语义上讲,class和typename是等将的。即使是template 你也可以使原创 2009-12-30 08:51:00 · 569 阅读 · 0 评论 -
C++ Templates笔记 8 技巧性基础知识关键字typename
#include #include // print elements of an STL containertemplate void printcoll (T const& coll){ typename T::const_iterator pos; // iterator to iterate over coll typename T::const_iterat原创 2009-12-30 15:48:00 · 618 阅读 · 0 评论 -
C++ Templates笔记 5 类模板的特化
#include #include #include //#include "stack1.hpp"#include #include #include #include template class Stack { private: std::vector elems; // elements public:原创 2009-12-30 13:51:00 · 459 阅读 · 0 评论 -
STL set
今日做SRM,用到了SET,整理一下 Set is a Sorted Associative Container that stores objects of type Key. Set is a Simple Associative Container, meaning that its value type, as well as its key type, is Key. It i转载 2009-12-09 11:42:00 · 1962 阅读 · 0 评论 -
C++ void指针与NULL指针
指针有两个属性:指向变量/对象的地址和长度 但是指针只存储地址,长度则取决于指针的类型 编译器根据指针的类型从指针指向的地址向后寻址 指针类型不同则寻址范围也不同,例如: int*从指定地址向后寻找4字节作为变量的存储单元 double*从指定地址向后寻找8字节作为变量的存储单元void几乎只有“注释”和限制程序的作用 void真正发挥的作用在于:(1) 对函数返回的限定;(2)原创 2010-01-31 22:06:00 · 3267 阅读 · 1 评论 -
程设基础面试问题
一、基础知识 1、 下面几个是在编程领域里经常使用的缩写,请写出他们的英文全写,并翻译成中文。注意是编程领域. (1) OS Operator System (2) VS Visual Studio ? (3) MS Microsoft (4) CS Client/Server ? (5) RTOS Real Time Operator System (6) SDK Software De转载 2009-12-03 15:58:00 · 686 阅读 · 0 评论 -
VS 2008 添加头文件路径!
VS 2008 添加头文件路径 在OpenCV MPICH2 OpenGL中都存在着这个问题,这样子轻松解决! 工程上右键->属性->配置属性->C/C++->附加包含目录原创 2010-01-16 16:30:00 · 3221 阅读 · 0 评论 -
fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾的解决办法
项目从VC6换到VS2003,编译的时候提示如下:logEx.cpp(189) : fatal error C1010: 在查找预编译头指令时遇到意外的文件结尾查了下资料发现,原来是它的头文件中没有引用#include "Stdafx.h"由于这个类是我自已写的,我不打算加入Stdafx.h的引用,所以要做一下修改,如下:1、选中提示出错的文件,这里是logEx.cpp。2、在选中的文件上右键选属转载 2010-04-28 17:19:00 · 1670 阅读 · 0 评论