creditverification.cpp

来自「Visual_C++[1].NET_Bible1 Visual_C++宝典书中」· C++ 代码 · 共 32 行

CPP
32
字号
// CreditVerification.cpp 
#include "stdafx.h"

#define _DLL
#include "creditverification.h"

BOOL APIENTRY DllMain(HANDLE hModule,
	DWORD  ul_reason_for_call, LPVOID lpReserved)
{
    return TRUE;
}

void CCreditVerification::SetCardType(char* s)
{
	if (0 == strcmp("Visa", s))
		m_type = Visa;
	else if (0 == strcmp("MasterCard", s))
		m_type = MasterCard;
	else m_type = Amex;
}

bool CCreditVerification::VerifyCardNumber(long n) 
{
	if (m_type == Visa)
		return (n % 2);
	else if (m_type == MasterCard)
		return (n % 3);
	else if (m_type == Amex)
		return (n % 5);
	else return false;
}

⌨️ 快捷键说明

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