1 struct Matrix { 2 int n , m ; 3 int mat[M][M] ; 4 int * operator [] (int x) { 5 return mat[x] ; 6 }...
分类:
其他好文 时间:
2015-07-31 14:30:59
阅读次数:
130
??
#include
#include
#include
using namespace std;
struct node
{
bool operator()(int &x,int &y)//优先级
{
return x>y;
}
};
priority_queue,node> que;//队列
int main()
{
int n;
scanf...
分类:
其他好文 时间:
2015-07-30 11:25:14
阅读次数:
118
#include
#include
using namespace std;
int N,M;
struct edge { int u,v,cost;
bool operator < (const edge& rhs) const
{
return cost < rhs.cost;
}
};
edge es[110];
int sett[110];
int...
分类:
其他好文 时间:
2015-07-30 09:34:48
阅读次数:
125
假设一个定义类的默认构造函数,然后构造这个类的对象数组将是一个问题。从而实现遗嘱new运营商掰开使用代码。首先,分配内存,然后调用构造函数对象分配内存。的代码做一个简单的备忘。//未定义构造函数的类不能定义该类的对象数组,内置类型除外//operator new + ctor//dtor + ope...
分类:
编程语言 时间:
2015-07-30 09:19:14
阅读次数:
167
20150728 星期二 上海 晴 高温
日志只是随笔摘要,供自己后续整理查看。
重载操作符
1. 重载操作符是特殊的函数,operator后加要重载的操作符,和其他函数一样,重载操作符函数也有参数和返回值。格式如下:
Data operator+(const data1&, const data2&)
2. 不可以重载的操作符:
:: .* . ?:
3. 可...
分类:
其他好文 时间:
2015-07-29 01:03:01
阅读次数:
119
开始想用kruskal算法自己写写runtime error
#include
#include
#include
using namespace std;
int a[2510][25100];
struct weight
{
int a,b;
int value;
bool operator < (const weight & rhs) const
{...
分类:
编程语言 时间:
2015-07-28 21:09:04
阅读次数:
145
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.思路:首先想到的机试不断地减去一个数直到0为止,但是这样得复杂度为O(n),只得...
分类:
其他好文 时间:
2015-07-28 15:55:30
阅读次数:
112
#include
using namespace std;
class x
{
public:
x(int ii=0);
void modify();
x f8();
~x();
x& operator=(const x &x1);
private:
int i;
};
x::x(int ii/* =0 */):i(ii)
{
cout<<"x(): "<<this<<end...
分类:
编程语言 时间:
2015-07-28 13:04:46
阅读次数:
167
如果在编译MFC程序的时候出现下列及类似的错误:1>uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) 已经在 LIBCMTD.lib(new.obj)...
分类:
其他好文 时间:
2015-07-28 10:35:24
阅读次数:
155
CString类的定义如下:class CMyString{public: CMyString(const char* pData=NULL); CMyString(const CMyString& str); CMyString& operator=(const CMyStrin...
分类:
编程语言 时间:
2015-07-28 10:23:10
阅读次数:
171