Coding Ceaser Chiper Bahasa C++

 

#include<iostream>

using namespace std;

int main () {
int n, k, mod, counter = 0, kurang, hasilmod;
char alfabet = 'a', huruf;

cout << "\n===== Algoritma Ceaser Chiper =====" << endl;
cout << "--- Chipertext to Plaintext ---" << endl;

cout << "\nK = ";
cin >> k;

cout << "Modulus = ";
cin >> mod;

cout << "Masukkan Banyak Huruf = ";
cin >> n;

for(int i = 1; i <= n; i++) {
cout << "\nMasukkan Huruf = ";
cin >> huruf;

counter = 0;
for(alfabet = 'a'; alfabet <= 'z'; alfabet++) {
if(huruf == alfabet) {
cout << "Posisi Huruf ke-" << counter << endl;
kurang = counter - k;
if(kurang < 0) {
hasilmod = ((kurang % mod) + mod) % mod;
} else {
hasilmod = kurang % mod;
}
}
counter++;
}
cout << ">> Hasil Mod = " << hasilmod << endl;
}


}

Komentar

  1. Baccarat in Texas - FBCasino.com
    A single, single poker hand is 카지노사이트 drawn out from a poker table. febcasino For a game that takes place from 5 to 20 minutes, players who are betting 메리트 카지노 주소 on the “odds

    BalasHapus

Posting Komentar