Inside-C++-Object-Model
C++ Primer Plus, Fourth Edition presents the ANSI C++ standard beginning with a discussion of the essential elements of C++ programming: loops, expressions, functions, and classes. It walks readers through the basics of object-oriented programming: classes, inheritance, templates, and exceptions, as well as the latest object-oriented programming techniques. C++ Primer Plus contains hundreds of sample programs. The friendly tone, concise programs, and end-of-chapter review exercises allow beginners to write their own programs immediately.
创世纪的C++ Builder教程 C++_Builder_html.rar
创世纪的C++ Builder
--------------------------------------------------------------------------------
告别Hello World的年代
图形程式设计基本概念
具体而微的绘图程式
以C++ Builder处理Windows讯息(Message)
动态链结函式库(DLL-Dynamic Linked Library)
Install Shield的使用介绍
清华大学数据结构讲义
众所周知,计算机的程序是对信息进行加工处理。在大多数情况下,这些信息并不是没有组织,信息(数据)之间往往具有重要的结构关系,这就是数据结构的内容。那么,什么是数据结构呢?先看以下几个例子。
例1、电话号码查询系统
设有一个电话号码薄,它记录了N个人的名字和其相应的电话号码,假定按如下形式安排:
(a1,b1)(a2,b2)…(an,bn)
其中ai,bi(i=1,2…n) 分别表示某人的名字和对应的电话号码要求设计一个算法,当给定任何一个人的名字时,该算法能够打印出此人的电话号码,如果该电话簿中根本就没有这个人,则该算法也能够报告没有这个人的标志。
C++历年考试题及答案
全国2005到2008年的历年高等教育自学考试题
发到网供大家共享,方便大家的学习信息来源于http://hexun.com/liuwen_1/default.html
visualC 完全自学手册代码
很实用的啊,想很好掌握VC的人使用的
《C/C++程序员实用大全》配套代码
[涉及平台] VC++
[作者] void
[文件大小] 629KB
[更新日期] 2005-10-28
本代码来自CZVC编程网:
HTTP://WWW.CZVC.COM
DOS 概述及入门到精通
现在虽然是windows的天下了,但是DOS以小巧方便、可对硬件直接操作等诸多优点,在PC使用中仍占有一席之地.正如一句话所说:DOS不是万能的,但没有DOS却是万万不能的.那么该如何学习DOS
《C/C++/C#程序员实用大全(精华版)》源代码
// test.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "test.h"
#include "MainFrm.h"
#include "testDoc.h"
#include "testView.h"
#include <initguid.h>
#include "Test_i.c"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestApp
BEGIN_MESSAGE_MAP(CTestApp, CWinApp)
//{{AFX_MSG_MAP(CTestApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestApp construction
CTestApp::CTestApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CTestApp object
CTestApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CTestApp initialization
BOOL CTestApp::InitInstance()
{
if (!InitATL())
return FALSE;
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CTestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CTestView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
{
return TRUE;
}
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CTestApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CTestApp message handlers
CTestModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()
LONG CTestModule::Unlock()
{
AfxOleUnlockApp();
return 0;
}
LONG CTestModule::Lock()
{
AfxOleLockApp();
return 1;
}
LPCTSTR CTestModule::FindOneOf(LPCTSTR p1, LPCTSTR p2)
{
while (*p1 != NULL)
{
LPCTSTR p = p2;
while (*p != NULL)
{
if (*p1 == *p)
return CharNext(p1);
p = CharNext(p);
}
p1++;
}
return NULL;
}
int CTestApp::ExitInstance()
{
if (m_bATLInited)
{
_Module.RevokeClassObjects();
_Module.Term();
CoUninitialize();
}
return CWinApp::ExitInstance();
}
BOOL CTestApp::InitATL()
{
m_bATLInited = TRUE;
#if _WIN32_WINNT >= 0x0400
HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
HRESULT hRes = CoInitialize(NULL);
#endif
if (FAILED(hRes))
{
m_bATLInited = FALSE;
return FALSE;
}
_Module.Init(ObjectMap, AfxGetInstanceHandle());
_Module.dwThreadID = GetCurrentThreadId();
LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
TCHAR szTokens[] = _T("-/");
BOOL bRun = TRUE;
LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens);
while (lpszToken != NULL)
{
if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
{
_Module.UpdateRegistryFromResource(IDR_TEST, FALSE);
_Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd
bRun = FALSE;
break;
}
if (lstrcmpi(lpszToken, _T("RegServer"))==0)
{
_Module.UpdateRegistryFromResource(IDR_TEST, TRUE);
_Module.RegisterServer(TRUE);
bRun = FALSE;
break;
}
lpszToken = _Module.FindOneOf(lpszToken, szTokens);
}
if (!bRun)
{
m_bATLInited = FALSE;
_Module.Term();
CoUninitialize();
return FALSE;
}
hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE);
if (FAILED(hRes))
{
m_bATLInited = FALSE;
CoUninitialize();
return FALSE;
}
return TRUE;
}
c~c++程序员实用大全3
#include <iostream>
#include <string>
using namespace std;
class Employee
{
public:
Employee(char *name, char sex, int age, char *phone) {
strcpy(Employee::name, name);
Employee::sex = sex;
Employee::age = age;
strcpy(Employee::phone, phone);
};
friend ostream& operator<< (ostream& cout, Employee emp);
private:
char name[256];
char phone[64];
int age;
char sex;
};
ostream& operator<< (ostream& cout, Employee emp)
{
cout << "Name: " << emp.name << "\tSex: " << emp.sex;
cout << "\tAge: " << emp.age << "\tPhone: " << emp.phone << endl;
return cout;
}
void main(void)
{
Employee worker("Happy", 'M', 4, "555-1212");
cout << worker ;
}
C++快速入门方法及例子
看到的好东西和大家分享...
新手入门:C/C++中数组和指针类型的关系
对于数组和多维数组的内容这里就不再讨论了,前面的教程有过说明,这里主要讲述的数组和指针类型的关系,通过对他们之间关系的了解可以更加深入的掌握数组和指针特性的知识!
一个整数类型数组如下进行定义:
int a[]={1,2,3,4};
如果简单写成:
a;//数组的标识符名称
这将代表的是数组第一个元素的内存地址,a;就相当于&a[0],它的类型是数组元素类型的指针,在这个例子中它的类型就是int*
如果我们想访问第二个元素的地址我们可以写成如下的两种方式:
&a[1];
a+1//注意这里的表示就是将a数组的起始地址向后进一位,移动到第二个元素的地址上也就是a[0]到a[1]的过程!
数组名称和指针的关系其实很简单,其实数组名称代表的是数组的第一个元素的内存地址,这和指针的道理是相似的!
下面我们来看一个完整的例子,利用指针来实现对数组元素的循环遍历访问!
#include <iostream>
using namespace std;
void main(void)
{
int a[2]={1,2};
int *pb=a; //定义指针*pb的地址为数组a的开始地址
int *pe=a+2; //定义指针*pb的地址为数组a的结束地址
cout << a << "|" << a[0] << "|" << *(a+1) << "|" << pb << "|" << *pb <<endl;
while (pb!=pe) //利用地址进行逻辑判断是否到达数组的结束地址
{
cout << *pb << endl;
pb++; //利用递增操作在循环中将pb的内存地址不断向后递增
}
cin.get();
}