摘要:文件打开文件时判断文件是否存在:ifstream f("123.txt");if (!f) cout#includeusing namespace std;int date2week(int date){ time_t rawTime; time(&rawTime); struct tm* timeInfo = localtime(&rawTime); timeInfo->tm_year = date / 10000 - 1900; timeInfo->tm_mon = date/100 %100 - 1; timeInfo->tm_mda
阅读全文
摘要:新建工程,选Win32 Dynamic-Link Library,工程名为dll例子,然后选A DLL that exports some symbols,完成.工程已经有了一个类CDll,一个变量nDll和一个函数fnDll.在类CDll中添加例子函数f.在dll例子.h中添加#ifdef __cplusplusextern "C" {#endif和#ifdef __cplusplus}#endif以下是dll例子.h的代码://手动添加#ifdef __cplusplus // If used by C++ code, extern "C" { //
阅读全文
摘要:程序A中共享数据, 代码:// 内存共享数据A.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "内存共享数据A.h"#includeusing namespace std;#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif//////////////////////////////////////
阅读全文
摘要:#pragma warning(disable:4786)#include#include#include#includeusing namespace std;int gOrient[4][2] = {-1,0, 1,0, 0,-1, 0,1};//-----------------------------------------------------------------------------class State{public: int findPos(int n) const; bool operator calculated; priority_queue ...
阅读全文