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

編程英文加密

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

閱讀全文

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

熱點內容
考駕照怎麼找伺服器 瀏覽:882
阿里雲伺服器如何更換地區 瀏覽:970
手機app調音器怎麼調古箏 瀏覽:501
銳起無盤系統在伺服器上需要設置什麼嗎 瀏覽:17
紅旗計程車app怎麼應聘 瀏覽:978
如何編寫linux程序 瀏覽:870
吉利車解壓 瀏覽:248
java輸入流字元串 瀏覽:341
安卓軟體沒網怎麼回事 瀏覽:785
dvd壓縮碟怎麼導出電腦 瀏覽:274
冒險島什麼伺服器好玩 瀏覽:541
如何在伺服器上做性能測試 瀏覽:793
命令序列錯 瀏覽:259
javaif的條件表達式 瀏覽:576
手機app上傳的照片怎麼找 瀏覽:531
雲伺服器面臨哪些威脅 瀏覽:748
c語言各種編譯特點 瀏覽:177
路由器多種加密方法 瀏覽:604
程序員阻止電腦自動彈出定位 瀏覽:168
如何做伺服器服務商 瀏覽:763