C++
Narvik
这个作者很懒,什么都没留下…
展开
-
toupper()
#include #include #include using namespace std;int main(){ string str("some string!!!"); string::size_type space_cnt=0; for(string::size_type ix=0;ix!=str.size();++ix) cout<<toupper(str[ix]原创 2013-04-03 10:00:37 · 1060 阅读 · 0 评论 -
GDI坐标系之间的关系
设置坐标映射(1)Windows坐标系统Windows坐标系分为逻辑坐标系和设备坐标系两种,GDI支持这两种坐标系。一般而言,GDI的文本和图形输出函数使用逻辑坐标,而在客户区移动或按下鼠标的鼠标位置是采用设备坐标。逻辑坐标系是面向DC的坐标系,这种坐标不考虑具体的设备类型,在绘图时,Windows会根据当前设置的映射模式将逻辑坐标转换为设备坐标。设备坐标系是面向物理设转载 2013-06-25 16:07:39 · 1106 阅读 · 0 评论 -
设备坐标和逻辑坐标
要用到两个函数:CDC::LPtoDP 将逻辑坐标转换为设备坐标CDC::DPtoLP 将设备坐标转换为逻辑坐标 设备坐标(Device Coordinate)又称为物理坐标(Physical Coordinate),是指输出设备上的坐标。通常将屏幕上的设备坐标称为屏幕坐标。设备坐标用对象距离窗口左上角的水平距离和垂直距离来指定对象的位置,是以像素为单位来表示的,转载 2013-06-25 15:54:15 · 594 阅读 · 0 评论 -
文件夹浏览(SHBrowseForFolder)
一.首先要为SHBrowseForFolder准备一个结构体BROWSEINFOtypedef struct _browseinfoW { HWND hwndOwner; PCIDLIST_ABSOLUTE pidlRoot; LPWSTR pszDisplayName; // Return display name of ite转载 2013-05-12 00:16:27 · 759 阅读 · 0 评论 -
C++ primer中的protected 成员深入理解
C++ primer中的protected 成员深入理解protected成员:(《C++ primer》P475给出的概念,因为翻译的问题,发现很多地方“类的用户”是指我们常说的“对象”)像private成员一样,protected成员不能被类的用户(也称为对象) 访问。 像public成员一样,protected成员可被该类的派生类访问。 派生类只能通过派生类对象访问其基类转载 2013-04-21 22:03:23 · 754 阅读 · 0 评论 -
二维数组2
#include #include using namespace std;int main(){ int ia[3][4]={0,1,2,3,4,5,6}; //typedef int int_array[4]; //int_array *ip=ia; //for(int_array *p=ia;p!=ia+3;++p) for(int (*ip) [4]原创 2013-04-06 15:38:18 · 562 阅读 · 0 评论 -
二维数组
#include #include using namespace std;int main(){ int ia[3][4]={0,1,2,3,4,5,6}; int *ip; ip=ia[1]; cout<<*ip<<endl; return 0;} ia[1]在本代码中应该是一个具体的值,而不是一个指针。原创 2013-04-06 15:01:55 · 453 阅读 · 0 评论 -
bitset中的flip()函数
#include #include using namespace std;int main(){ bitset bitvec3(0xfff1); unsigned long ulong =bitvec3.to_ulong(); cout<<"before flip:ulong="<<ulong<<endl; bitvec3.flip(); ulong=bitvec3.to_u原创 2013-04-04 20:17:15 · 1010 阅读 · 0 评论 -
size_type
#include //#include using namespace std;int main(){ string str("some string"); for(string::size_type ix=0;ix!=str.size();++ix) cout<<str[ix]<<endl; return 0;}原创 2013-04-03 09:35:08 · 576 阅读 · 0 评论 -
关于string类型的定义
#include #include using namespace std;int main(){ string s; int a; cin >> s; cout<<s<<endl; return 0;} 在没有include后,程序显示string类型是已经被定义的,这说明string类型的定义并不是在文件中,在点击string类型后,VS打开了名为原创 2013-04-02 22:13:38 · 1182 阅读 · 0 评论 -
关于VC中 error C2871: 'std' : does not exist or is not a namespace
#include using namespace std;然后编译时出现 error C2871: 'std' : does not exist or is not a namespace查了一下,原来 C++有两个不同版本的头文件。引入名字空间这个概念以前编译器用的是#include ,而引入名字空间的概念以后std名字空间的头文件名字变成了。是比较老的C++的头文件的版本,而namespace转载 2013-07-21 20:43:11 · 818 阅读 · 0 评论