C++
文章平均质量分 65
hhdong123
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
修改VS2012的全局包含路径
第一种:视图->属性管理器 手动选择是debug还是release版本打开其中的win32.user.props 来手动修改包含目录第二种:修改配置文件(当界面配置失效 这种方法是最有效)C:\Users\Administrator\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props原创 2013-12-31 10:21:30 · 839 阅读 · 0 评论 -
BMP位图读取部分代码
#define WIDTHBYTES(bits) (((bits)+31)/32*4) BITMAPFILEHEADER fileHeader; BITMAPINFOHEADER infoHeader; tagRGBQUAD *tagRgb; FILE* pfin =fopen("liu.bmp","rb"); //Read the Bitmap f转载 2014-03-04 09:37:13 · 802 阅读 · 0 评论 -
实用模板
templatetypename T>inlinevoid SafeDelete(T*&p){ delete p; p = 0; }templatetypename T>inlinevoid SafeDeleteArray(T*&p){ delete[] p; p = 0; }template typename T>inline voidUnus转载 2014-01-17 16:29:03 · 584 阅读 · 0 评论 -
友员函数
#include using namespace std;class Integer{ int n;public: Integer(int x = 0){ n = x; }; friend int sum(Integer& a, Integer &b); friend class Operation;};int sum(Integer &a, Integ转载 2013-12-25 22:12:09 · 808 阅读 · 0 评论 -
C/C++中利用空指针简化代码,提高效率
这里的写法,可以避免使用 for 循环,减少栈空间内存的使用和减少运行时的计算开销!#include #include using namespace std; void print_char(char* array[]);//函数原形声明 void main(void) { char* test[]=转载 2013-12-26 09:03:20 · 592 阅读 · 0 评论 -
运算符重载(一)
重载为友员函数。 #include using namespace std;class Clock{private: int s; int m; int h;public: void display(); Clock(Clock &); Clock(int, int, int); friend Clock operator+(int, Clock&)转载 2013-12-25 22:25:31 · 597 阅读 · 0 评论 -
指针与引用
#include "iostream"using namespace std;void testRef(){ int i=10; //引用不可以为空,他是一个对象的别名 int & ref=i; ref++; cout<<"i="<<i<<endl; cout<<"ref="<<ref<<endl; int j=20; //i=j 引用不可以改变指向,引用的操作直接反映到所原创 2013-12-24 10:07:49 · 532 阅读 · 0 评论 -
bind与function(一)
#include "stdafx.h"#include "iostream"#include using namespace std;using namespace placeholders;class MyFun{public: void print(int i,int j) { cout<<i<<"\t"<<j<<endl; } void hehe(int i) {转载 2013-12-24 08:49:13 · 523 阅读 · 0 评论 -
简单的bind实现
#include "main.h"#include "iostream"#include using namespace std;namespace{ class placeholder_{}; placeholder_ _1;}templateclass simple_bind_t{private: typedef R(T::*F)(a转载 2013-12-23 22:08:32 · 608 阅读 · 0 评论 -
Opengl学习笔记一
#include#include #define FREEGLUT_STATIC#include GLBatch triangleBatch;GLShaderManager shaderManger;void ChangeSize(int w,int h){ /* glViewport (GLint x, GLint y, GLsizei width, GLsizei heigh原创 2013-12-31 10:43:10 · 612 阅读 · 0 评论 -
简单的UTF8 UNICODE之间的转换
使用wstring#include #include string>#include #include #include int main(int argc, char *argv[]){ std::wstring str = L"123,我是谁?我爱钓鱼岛!"; std::wstring_convert> conv; std原创 2014-04-09 09:36:15 · 583 阅读 · 0 评论
分享