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

📄 substitution.cpp

📁 This program sorts words in a line of text by length.
💻 CPP
字号:
#include <iostream.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>

#define offset 5

void main()
{
	clrscr();
	char msg[50];
	int i,l;
	char encrypt[26];
	char k;
	k='A';
	for(i=0;i<26;i++,k++)
	{
		if(char(k+offset)<='Z')
			;
		else
			{
				k='A'-5;
			}
		encrypt[i]=char(k+offset);

	}
	cout<<"\n\n\t\t\tEncryption by Substitution";
	cout<<"\n\tEnter your message : ";
	gets(msg);
	i=0;
	l=strlen(msg);
	for(i=0;i<l;i++)
	{
		msg[i]=toupper(msg[i]);
		msg[i]=encrypt[int(msg[i]-'A')];
	}
	cout<<"\n\tEncrypted message is : ";
	puts(msg);
	getch();
}

⌨️ 快捷键说明

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