自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 对DC的一些理解

计算机图形显示设备品种繁多,原理和结构差别巨大,所以要求程序设计人员掌握对所有图形显示设备进行编程是不现实的。为此,出现了一个统一的虚拟图形显示设备,而虚拟图形显示设备转换为物理设备图形的任务则由系统去完成!         在WindowS中,这个虚拟图形设备表现为一个叫做图形设备描述表的数据结构,它描述了虚拟图形设备的属性,所以也叫做图形设备描述环境,简称DC。

2012-10-30 19:30:25 979

原创 动态创建类的对象

#include #includeusing namespace std;class CObject;///类信息表结构struct CRuntimeClass{ char* m_lpszClassname ; //类名 CObject* (_stdcall *m_pfnCreateObject)(); ///对象构建函数指针 CObject* _std

2012-10-30 18:58:47 1099 1

原创 多维动态数组

《C++  Primer》中说:在C++中没有多维数组,只有元素师数组的数组。如:要想创建一个二维整数数组,首先要创建一个一维动态数组,它由int *类型的指针构成。int*就是这个一维int指针数组的类型。 下面举例说明// String.cpp : Defines the entry point for the console application.//#incl

2012-10-26 16:02:26 739

原创 使用动态数组

1、定义一个指针类型如:typedef   double*   DoubleArrayPtr;2、声明一个指针变量如: DoubleArrayPtr   a;3、调用newa =  new   double[ array_size ];4:、动态数组的长度在方括号中给出5、像普通数组那样使用6、调用delete [ ]如:delete  [ ]   a;

2012-10-26 12:53:04 1522

原创 使用向量

// String.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include#includeint main(int argc, char* argv[]){ using namespace std; vector v; cout<<"E

2012-10-25 12:01:20 672

原创 string对象和C字符串之间的转换

// String.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include#includeint main(int argc, char* argv[]){ using namespace std; string string_variab

2012-10-25 11:03:44 2942

原创 string对象具有类似数组的行为

可以像处理数组那样来处理String 对象!// String.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include#includeint main(int argc, char* argv[]){ using namespace std; st

2012-10-25 10:49:22 1029

原创 C++中字符串I/O

可以使用cout和插入操作符可以使用cin和提取操作符>>时,方式和其他数据一样,但要注意:>>会忽略最初的空白字符,并在遇到更多的空白字符时停止读入!// String.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include#include#includ

2012-10-25 10:26:47 1388

原创 将C字符串转换为整数

// c string to int.cpp : Defines the entry point for the console application./////功能::将C字符串转换为整数#include "stdafx.h"#include#include ////atoi()#define MAX 65535int main(int argc, char* argv

2012-10-24 21:36:21 1001

原创 复制文件中的内容到另一个文件

// C String.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include#include#includeint main(int argc, char* argv[]){ using namespace std; char arrstr[1024]

2012-10-24 20:44:43 1387

原创 虚拟继承

#includeenum{BLACK = 1, BROWN};class CHuman{public : int m_hairColor;};class CFather :virtual public CHuman{};class CMother :virtual public CHuman{};class CMe : public CFather , public

2012-10-23 15:52:26 527

原创 一个类的友元类能访问类的私有数据

// test.cpp : Defines the entry point for the console application.//#include "stdafx.h"class CAnimal{public : int m_sex;public: void SetSex(int sex) {  m_sex = sex; } //*******

2012-10-22 22:06:12 1671 1

原创 友函数访问类的私有数据成员

#include "stdafx.h"class CAnimal{public : int m_sex;public: void SetSex(int sex) {  m_sex = sex; } //****************************** //定义友元函数 friend int GetSex(CAnimal& am); /

2012-10-22 22:03:58 921

原创 走进MFC之一

Visual  C++(简称VC++)支持MFC的程序开发,他是一个集成开发环境(IDE),也就是所谓的Visual  Studio的一部分。 集成开发环境是指从程序的编辑、编译、链接、执行、调试和联机帮助等,都是在一个程序内完成。VC++提供MFC Application Wizard,帮助程序员建立一套基础程序,再从它的基础上开发工程;另外,还有Class Wizard可以帮助

2012-10-21 17:52:48 567

原创 getchar()、getch()、getche()

#include#includevoid main(){ char ch; ch = getche(); printf("%c\n",ch);} #include#includevoid main(){ char ch; ch = getch(); printf("%c\n",ch);}  #includevoid main(){

2012-10-21 14:07:57 632

原创 C++下多线程的创建

在C语言下面,创建多线程不是很复杂,直接调用win32的CreateThread函数就可以了。但是怎么用C++创建多线程确实是一个问题。一方面,创建线程中的函数指针不能是成员函数,一方面我们希望可以把成员函数当作是线程的入口函数,这中间应该怎么调和呢?       我想,要想做到这一点可以充分利用C++语言的两个特性,一个是this指针,一个就是静态函数。利用this指针可以传递入口参数,

2012-10-18 21:04:26 2790

原创 C中程序的内存分配

一、预备知识-程序的内存分配       一个由c/C++编译的程序占用的内存分为以下几个部分       1、栈区(stack)- 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。       2、堆区(heap) - 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收 .注意它与数据结构中的堆是两回事,分配方式倒是

2012-10-18 21:00:26 850

转载 C++多源码文件简单组织

基本上和C的是一样的,只不过C++的方法要在类中声明。看一个简单实例。       ainimal.h  类里面对外公开的信息。       #ifndef _ANIMAL_H__       #define _ANIMAL_H__       #include        using namespace std;       class Anim

2012-10-18 20:56:08 883

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除