導航:首頁 > 文檔加密 > 編程英文加密

編程英文加密

發布時間: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

閱讀全文

與編程英文加密相關的資料

熱點內容
通達信vix恐慌指數源碼 瀏覽:21
火力app在哪裡下載 瀏覽:97
linux查看安裝的服務 瀏覽:172
tp277觸摸屏編程軟體 瀏覽:419
命令按鈕能不能獲得焦點 瀏覽:558
專屬程序員的瀏覽器 瀏覽:707
cad圖形界限命令 瀏覽:219
單片機什麼時候中斷 瀏覽:50
稱重天平演算法 瀏覽:167
3d編程游戲軟體 瀏覽:555
如何創建一個app代取快遞 瀏覽:160
如何通過用友nc查伺服器系統 瀏覽:59
河南內網ftp伺服器託管雲主機 瀏覽:634
pdf傘退 瀏覽:864
啟動埠命令 瀏覽:978
中國程序員最新消息 瀏覽:756
通達信基本面主圖源碼 瀏覽:458
linuxphpgd擴展 瀏覽:647
有蛋殼的是哪個app 瀏覽:599
漢語語法學pdf 瀏覽:36