📄 caculate.cpp
字号:
#include "stdafx.h"
#include "Caculate.h"
CCaculate::CCaculate()
{
m_nListSize = 0;
}
CCaculate::CCaculate(const CCaculate& oOther)
{
if (this == &oOther)
return;
else
{
m_nListSize = oOther.m_nListSize;
m_vNameList = oOther.m_vNameList;
}
}
CCaculate::~CCaculate()
{
}
int CCaculate::LuckClick(CString& strLuck)
{
int nIdx = 0;
if (m_nListSize > 0)
{
nIdx = rand() % m_nListSize;
m_nListSize--;
}
else
{
return 0;
}
vector<CString>::iterator iPos;
iPos = m_vNameList.begin();
int i = 0;
while (i < nIdx)
{
iPos++;
i++;
}
strLuck = (*iPos);
iPos = m_vNameList.erase(iPos);
return nIdx;
}
int CCaculate::AddName(CString strName)
{
if (!strName.IsEmpty())
{
m_vNameList.push_back(strName);
m_nListSize++;
return 1;
}
else
{
return 0;
}
}
int CCaculate::GetListSize()
{
return m_nListSize;
}
void CCaculate::GetNameList(vector<CString>& vNameList) const
{
vNameList = m_vNameList;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -