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

📄 kaisa.cpp

📁 本程序是用来将客户选定图书放入购书车。使用户对图书的购买信息有详细的了解
💻 CPP
字号:
// Kaisa.cpp: implementation of the CKaisa class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "恺撒密码.h"
#include "Kaisa.h"

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

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

CKaisa::CKaisa()
{

}

CKaisa::~CKaisa()
{

}
void CKaisa::kaisa()
{
	if(mode==0)//加密
		encrypt();
	else//解密
		decrypt();
}

bool CKaisa::encrypt()//加密
{
	int i;	char ch;
	for(i=0;i<mingwen.GetLength();i++)
	{
		ch=mingwen.GetAt(i);
/*		if(ch>='A'&&ch<='Z')
			ch='A'+(ch-'A'+key)%26;
		else
			if(ch>='a'&&ch<='z')
				ch='a'+(ch-'a'+key)%26;
*/
		ch=(ch+key)%256;
		result.Insert(i,ch);
	}
	return true;
}

bool CKaisa::decrypt()//解密
{
	int i;	char ch;
		for(i=0;i<mingwen.GetLength();i++)
	{
		ch=miwen.GetAt(i);
		ch=(ch+(256-key))%256;
		result.Insert(i,ch);
	}
	return true;
}

⌨️ 快捷键说明

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