Hızlı Konu Açma

Hızlı Konu Açmak için tıklayınız.

Son Mesajlar

Konulardaki Son Mesajlar

Reklam

Forumda Reklam Vermek İçin Bize Ulaşın

[JAVA] ROT 13 Şifreleme Sistemi

BlackKey

Üye
Fenerbahçe
Kayıtlı Üye
Katılım
12 Eylül 2014
Mesajlar
167
Tepkime puanı
0
Puanları
0
Kod:
[B]import java.io.*; [/B][COLOR=DarkOrange][B]import java.util.*; 

public class rot13 
{ 
    static Scanner console = new Scanner(System.in); 
     
    private static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); 
     
    public static **** main(String args[]) throws IOException 
    { 
        String plaintext; 
        int x; 
         
        System.out.println("Enter words to encrpyt"); 
        plaintext = stdin.readLine(); 
        x = plaintext.length(); 
        char[] chars = new char[x]; 
        for (int i = 0; i < x; i++) 
        { 
            chars[i] = plaintext.charAt(i); 
        } 
         
        System.out.print("The encrypted text is: "); 
         
        for (int i = 0; i < chars.length; i++) 
        { 
                if ((chars[i] >= 'a' && chars[i] <= 'm')) 
                { 
                    chars[i] += 13; 
                } 
                else if ((chars[i] >= 'n' && chars[i] <= 'z')) 
                { 
                    chars[i] -= 13; 
                } 
                else if ((chars[i] >= 'A' && chars[i] <= 'M')) 
                { 
                    chars[i] += 13; 
                } 
                else if ((chars[i] >= 'N' && chars[i] <= 'Z')) 
                { 
                    chars[i] -= 13; 
                } 
            System.out.print(chars[i]); 
        } 
    }  [/B][/COLOR][B]}  [/B]
 

Users Who Are Viewing This Konu (Users: 0, Guests: 1)

Üst