📄 dparticle.cpp
字号:
// DPARTICLE.cpp: implementation of the DPARTICLE class.
//
//////////////////////////////////////////////////////////////////////
#include "DPARTICLE.h"
#include <stdlib.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
DPARTICLE::DPARTICLE() //空构造函数
{
}
DPARTICLE::DPARTICLE(int n) //维数为参数的构造函数
{
Dim = n;
}
//微粒析构函数
DPARTICLE::~DPARTICLE()
{
delete [] X;
X = NULL;
delete [] V;
V = NULL;
delete [] XBest;
XBest = NULL;
}
//设置微粒的维数
void DPARTICLE::SetDim(int d)
{
Dim = d;
X = new int [Dim];
V = new int [Dim*Dim];
XBest = new int [Dim];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -