#include <stdio.h>
#include <conio.h>
#include <string.h>
int main ()
{
char kata [8];
char copy [8];
float hitung [8];
int pjg;
float a = 4.1, b = 5.1, c = 6.1, d = 7.1, e = 8.1;
float f = 0.1, g = 1.1, h = 2.1, i = 3.1, j = 4.2;
float k = 5.2, l = 6.2, m = 7.2, n = 8.2, o = 0.2;
float p = 1.2, q = 2.2, r = 3.2, s = 4.3, t = 5.3;
float u = 6.3, v = 7.3, w = 8.3, x = 9.3, y = 0.3;
float z = 2.3;
printf ("Masukkan input = ");
gets (kata);fflush (stdin);
strcpy(copy,kata);
pjg = strlen (kata);
for (int i=0;i<pjg;i++)
{
if (copy[i]=='a') {hitung[i]=a;}
if (copy[i]=='b') {hitung[i]=b;}
if (copy[i]=='c') {hitung[i]=c;}
if (copy[i]=='d') {hitung[i]=d;}
if (copy[i]=='e') {hitung[i]=e;}
if (copy[i]=='f') {hitung[i]=f;}
if (copy[i]=='g') {hitung[i]=g;}
if (copy[i]=='h') {hitung[i]=h;}
if (copy[i]=='i') {hitung[i]=i;}
if (copy[i]=='j') {hitung[i]=j;}
if (copy[i]=='k') {hitung[i]=k;}
if (copy[i]=='l') {hitung[i]=l;}
if (copy[i]=='m') {hitung[i]=m;}
if (copy[i]=='n') {hitung[i]=n;}
if (copy[i]=='o') {hitung[i]=o;}
if (copy[i]=='p') {hitung[i]=p;}
if (copy[i]=='q') {hitung[i]=q;}
if (copy[i]=='r') {hitung[i]=r;}
if (copy[i]=='s') {hitung[i]=s;}
if (copy[i]=='t') {hitung[i]=t;}
if (copy[i]=='u') {hitung[i]=u;}
if (copy[i]=='v') {hitung[i]=v;}
if (copy[i]=='w') {hitung[i]=w;}
if (copy[i]=='x') {hitung[i]=x;}
if (copy[i]=='y') {hitung[i]=y;}
if (copy[i]=='z') {hitung[i]=z;}
if (copy[i]==' ') {hitung[i]=3.3;}
}
printf ("hasil enkripsi = ");
for (int i=0;i<pjg;i++)
{
printf ("%.1f", hitung[i]);
}
for (int i=0;i<pjg;i++)
{
if (hitung[i]==a) {copy[i]='a';}
if (hitung[i]==b) {copy[i]='b';}
if (hitung[i]==c) {copy[i]='c';}
if (hitung[i]==d) {copy[i]='d';}
if (hitung[i]==e) {copy[i]='e';}
if (hitung[i]==f) {copy[i]='f';}
if (hitung[i]==g) {copy[i]='g';}
if (hitung[i]==h) {copy[i]='h';}
if (hitung[i]==i) {copy[i]='i';}
if (hitung[i]==j) {copy[i]='j';}
if (hitung[i]==k) {copy[i]='k';}
if (hitung[i]==l) {copy[i]='l';}
if (hitung[i]==m) {copy[i]='m';}
if (hitung[i]==n) {copy[i]='n';}
if (hitung[i]==o) {copy[i]='o';}
if (hitung[i]==p) {copy[i]='p';}
if (hitung[i]==q) {copy[i]='q';}
if (hitung[i]==r) {copy[i]='r';}
if (hitung[i]==s) {copy[i]='s';}
if (hitung[i]==t) {copy[i]='t';}
if (hitung[i]==u) {copy[i]='u';}
if (hitung[i]==v) {copy[i]='v';}
if (hitung[i]==w) {copy[i]='w';}
if (hitung[i]==x) {copy[i]='x';}
if (hitung[i]==y) {copy[i]='y';}
if (hitung[i]==z) {copy[i]='z';}
if (hitung[i]==3.3) {copy[i]=' ';}
}
printf ("\nhasil dekripsi = ");
for (int i=0;i<pjg;i++)
{
printf ("%c", copy[i]);
}
getche ();
return 0;
}