⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 collection.cpp

📁 一个完整的彩票软件的源代码
💻 CPP
字号:
// Collection.cpp: implementation of the CCollection class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "lottery.h"
#include "Collection.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CCollection::CCollection()
{

}

CCollection::~CCollection()
{

}

void CCollection::AddCollection(CCollection *pCol)
{
	int nSize=pCol->GetSize();
	for (int i=0; i<nSize; i++)
	{
		BYTE cByte=pCol->GetAt(i);
		if (Find(cByte) != -1) Add(cByte);
	}
}

int CCollection::Find(BYTE cByte)
{
	int nSize=GetSize();
	for (int i=0; i<nSize; i++)
	{
		if (cByte==GetAt(i)) return i;
	}
	return -1;
}

void CCollection::SubtractCollection(CCollection *pCol)
{
	int nSize=pCol->GetSize();
	for (int i=0; i<nSize; i++)
	{
		BYTE cByte=pCol->GetAt(i);
		int nIndex=Find(cByte);
		if (nIndex != -1) RemoveAt(nIndex,-1);
	}
}

void CCollection::CreateCompound(CArray<BYTE,BYTE>  *p, int nWidth)
{
	int nSize=GetSize();
	if (nSize < nWidth) return;
	ZeroMemory(m_com,30*sizeof(BYTE));
	for (int i=0; i<nSize; i++)
	{
		m_com[i]=GetAt(i);
	}
	m_nCount=0;
	Compound(nSize,nWidth,p, nWidth);
}

void CCollection::Compound(int n, int m,CArray<BYTE,BYTE>  *p, int nWidth)
{
	if (m==0)
	{
		for (int j=0; j<nWidth; j++) 
			p->Add(m_com2[j]);
		m_nCount++;
		return; 
	}
	else
	for (int i=n; i>=1; i--)
	{
		m_com2[m-1]=m_com[i-1];
		Compound(i-1,m-1,p, nWidth);
	}
	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -