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

编程英文加密

发布时间: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

阅读全文

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

热点内容
程序员寻找转行建议 浏览:632
psgrepjava 浏览:415
梦幻诛仙12职业变态源码 浏览:370
汽车的控制是怎么编程的 浏览:686
稳定的ip地址服务器 浏览:641
python多线程编程教程 浏览:252
笔记本编程电脑排行榜 浏览:32
微信好友缓存文件在哪个文件夹 浏览:614
javafloat小数点后两位小数 浏览:166
澳门pdf 浏览:409
es解压文件默认路径 浏览:833
jar命令war包 浏览:121
福州交警app预约在哪里签字确认 浏览:623
android各版本sdk异同 浏览:726
怎样在源码中找精灵图片 浏览:445
超声波防盗51单片机 浏览:460
国内程序员编程能力 浏览:184
女程序员没有晋升 浏览:136
微订点单外卖平台系统源码 浏览:572
云服务器30m 浏览:27