导航:首页 > 文档加密 > 编程英文加密

编程英文加密

发布时间:2024-10-18 06:17:00

A. C语言编程,对iloveyouaz进行加密解密,a推f,b推g,c推h,以此类推

#include<iostream.h>
main()
{
floata,b,s;

cout<<"ab"<<endl;
cin>>a>>b;//利用cin从键盘上为变量a,b赋值
s=a;
if(a<b){
s=b;//if语句中只有这一个语句,可省略花括号
}
s=s*s;//变量s中保存a,b中较大的一个数的平方
cout<<"s="<<s;
}

#include<iostream.h>
main()
{
intx,y;
cout<<"x=";
cin>>x;
if(x<=0){//满足条件执行
y=2*x;
cout<<"y="<<y;//输出结果
}
else{//不满足条件执行
y=x*x;
cout<<"y="<<y;//输出结果
}
}
#include<iostream.h>
main()
{
inta,b,c;
intsmallest;
cout<<"abc"<<endl;
cin>>a>>b>>c;
if(a<=b)//外层条件语句
{
if(a<=c)//内层条件语句
smallest=a;
else
smallest=c;
}
else
{
if(b<=c)//内层条件语句
smallest=b;
else
smallest=c;
}
cout<<"Smallest="<<smallest<<endl;
}

#include<iostream.h>
main()
{
intscore;

//从键盘上输入分数
cout<<"score=";
cin>>score;

//用带elseif的条件语句判断处理
if(score<0||score>100)
{
cout<<"Thescoreisoutofrange!"<<endl;
}
elseif(score>=90)
cout<<"YourgradeisaA."<<endl;
elseif(score>=80)
cout<<"YourgradeisaB."<<endl;
elseif(score>=70)
cout<<"YourgradeisaC."<<endl;
elseif(score>=60)
cout<<"YourgradeisaD."<<endl;
else
cout<<"YourgradeisaE."<<endl;
}
#include<iostream.h>
main()
{
intn;
cout<<"n=";
cin>>n;
if(n>=0&&n<=100&&n%2==0)
cout<<"n="<<n<<endl;
else
cout<<"The"<<n<<"isoutofrange!"<<endl;
}

#include<iostream.h>
main()
{
inta,b,Max;
//输入数据
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;

//找出较大值
Max=a>b?a:b;
cout<<"Max="<<Max<<endl;
}

#include<iostream.h>
main()
{
inta,b;
//输入数据
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;

//除法判断
if(b!=0&&a%b==0){
cout<<b<<"divides"<<a<<endl;
cout<<"a/b="<<a/b<<endl;
}
else
cout<<b<<"doesnotdivide"<<a<<endl;
}


#include<iostream.h>
main()
{
//x,y为操作数,c为运算符
intx,y,z;
charc1;
cin>>x>>c1>>y;//c1

//多路选择语句选择不同表达式计算语句
switch(c1){
case'+':cout<<x<<"+"<<y<<"="<<x+y<<endl;
break;
case'-':cout<<x<<"-"<<y<<"="<<x-y<<endl;
break;
case'*':cout<<x<<"*"<<y<<"="<<x*y<<endl;
break;
case'/':cout<<x<<"/"<<y<<"="<<x/y<<endl;
break;
case'%':cout<<x<<"%"<<y<<"="<<x%y<<endl;
break;
default:cout<<"Wrong!"<<endl;//当不符合上述情况时执行本子句
}
}

B. C语言题编程实现对键盘输入的大写英文字母进行加密。字母

#include<stdio.h>
#include<ctype.h>
intmain()
{inti;
chars[200];
gets(s);
for(i=0;s[i];i++)
if(isalpha(s[i]))
{s[i]+=3;
if(s[i]%0x20>26)s[i]-=26;
}
puts(s);
return0;
}

C. 编程实现英文文本的加密。。

Function jiami(str1 As String)/*加密*/
Dim l, str2, str
str = Trim(str1)
l = Len(str)
For i = 1 To l
If Asc(Mid(str, i, 1)) > 64 And Asc(Mid(str, i, 1)) < 113 Then
str2 = str2 & Chr(Asc(Mid(str, i, 1)) + 10)
ElseIf Asc(Mid(str, i, 1)) > 112 And Asc(Mid(str, i, 1)) < 123 Then
str2 = str2 & Chr(Asc(Mid(str, i, 1)) - 49)
Else
str2 = str2 & Mid(str, i, 1)
End If
Next
jiami = str2
End Function
Function jiemi(str1 As String) /*解密*/
Dim l, str2, str
str = Trim(str1)
l = Len(str)
For i = 1 To l
If Asc(Mid(str, i, 1)) > 74 And Asc(Mid(str, i, 1)) < 123 Then
str2 = str2 & Chr(Asc(Mid(str, i, 1)) - 10)
ElseIf Asc(Mid(str, i, 1)) > 64 And Asc(Mid(str, i, 1)) < 73 Then
str2 = str2 & Chr(Asc(Mid(str, i, 1)) + 49)
Else
str2 = str2 & Mid(str, i, 1)
End If
Next
jiemi = str2
End Function

D. 用java编程!从键盘输入一个字母,输出这个字母的加密结果,加密操作:将字母变成倒序的字母,如把a变成z。

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ChangeLetter {
public static void main(String[] args) {
String outputStr = ""氏银毁;
System.out.print("请输入字母:");
//从键盘输入字母
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
//读取行,赋值给inputStr
String inputStr = br.readLine();
for(int i=0;i<inputStr.length();i++){
//将转换后的字符连接成字符串输出
outputStr = outputStr + changeLetter(inputStr.charAt(i));
}
} catch (IOException e) {
e.printStackTrace();
}

System.out.println(outputStr);
}
public static char changeLetter(char c){
//用于后搏大台打印,知道Unicode码
/*Integer num1 = 'A';
Integer num2 = 'Z';
Integer num3 = 'a';
Integer num4 = '歼备z';
System.out.println(num1);
System.out.println(num2);
System.out.println(num3);
System.out.println(num4);*/
//unicode码
//A值为65
//Z值为90
//a值为97
//b值为122

int letter = c;
char character = 0;
if(c>=65&&c<=90){
//比如输入B,则运算步骤如下:
//90-(66-65)=89,89转换成字符则为Y
//以下小写的同理
character = (char)(90-(letter-65));
}
if(c>=97&&c<=122){
character = (char)(122-(letter-97));
}
return character;
}
}

运行结果:
请输入字母:ABCXYZabcxyz
ZYXCBAzyxcba

阅读全文

与编程英文加密相关的资料

热点内容
php取一条记录 浏览:134
cwindows高级编程 浏览:83
总想咬东西解压 浏览:113
显示扩展名的命令 浏览:285
androidascii码转字符串 浏览:312
php服务器并发 浏览:644
kalilinux系统安装 浏览:73
绿色生活app是什么 浏览:677
枪火重生文件夹 浏览:183
程序员智商划分 浏览:334
修炼一套好算法 浏览:296
空气净化pdf 浏览:311
necc文件夹 浏览:18
linux跑火车 浏览:357
androidsdk版本兼容 浏览:1004
果加密码锁开锁记录 浏览:446
python导入模块的形式 浏览:259
shor算法 浏览:58
python交易日历 浏览:47
怎样用云服务器组网 浏览:294