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

📄 lottorydata.cpp

📁 完成抽奖的基本功能。可以载入文本文件
💻 CPP
字号:
// LottoryData.cpp: implementation of the LottoryData class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "WinLottory.h"
#include "LottoryData.h"
#include "WinLottoryDoc.h"

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

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

LottoryData::LottoryData()
{
	m_nNodeId=0;
}

LottoryData::~LottoryData()
{

}
	// 链表头
//	LottoryDataNode* m_pNodeChainHead;
	// 前驱节点
//	LottoryDataNode* m_pNodeChainVan;
	// 当前节点
//	LottoryDataNode* m_pNodeChainCur;
	// 临时节点
//	LottoryDataNode* m_pNodeChainTemp;
	// 链表长度
//	int m_nChainLength;

LottoryDataNode* LottoryData::addNode(CString *string)
{

	if (m_pNodeChainHead==NULL)
	{
		LottoryDataNode* addNode = (LottoryDataNode*)malloc(sizeof(LottoryDataNode));
		
		addNode->content=*string;
		
		m_nNodeId++;
		addNode->num=m_nNodeId;
		
		m_nChainLength=1;

		m_pNodeChainHead=addNode;
		m_pNodeChainCur=addNode;
		m_pNodeChainVan=addNode;

		addNode=NULL;
	}
	else
	{
		LottoryDataNode* addNode = (LottoryDataNode*)malloc(sizeof(LottoryDataNode));
		
		addNode->content=*string;
		
		m_nNodeId++;
		addNode->num=m_nNodeId;

		m_nChainLength++;



//		pDoc->m_pNodeChainTemp->next = addNode;
//		pDoc->m_pNodeChainTemp = addNode;
		addNode=NULL;
	}

	return NULL;//pDoc->m_pNodeChain;
}

LottoryDataNode* LottoryData::delNode(int num)
{

/*	LottoryDataNode* head = pDoc->m_pNodeChain;
	LottoryDataNode* temp = NULL;
	while(true)
	{
		if (head->num==num)
		{
			if (head->next==NULL)
			{
				
			}
		}

		head->next=head;
	}

	return pDoc->m_pNodeChain;
	*/
	return NULL;
}

⌨️ 快捷键说明

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