#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    8
    Rep Power
    0

    Programing for encryption


    Hello,
    I'm trying to make a simple code in C for encrypting letters

    I started with two dimensional array but I dont know how can I complete the code.Could anyone help me please
    here is my code #include<stdio.h>

    int main()

    {
    char word;
    char a[27][2]={{'A','H'},{'B','F'},{'C','L'},{'D','R'},
    {'E','U'},{'F','O'},{'G','P'},{'H','C'},
    {'I','B'},{'J','A'},{'K','Z'},{'L','E'},
    {'M','W'},{'N','D'},{'O','G'},{'P','Y'},
    {'Q','I'},{'R','M'},{'S','K'},{'T','N'},
    {'U','X'},{'V','S'},{'W','J'},{'X','V'},
    {'Y','Q'},{'Z',' '},{' ','V'}};

    printf ("Enter your word to be encrypted\n");


    return 0;
    }
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    I could pretend you've made it obvious that you're trying to implement encryption with direct substitution. I suggest you take the pains to state what sort of encryption algorithm you propose, and show an example including input, output, reason for using c, and if it must be in c, study arrays in c longer. Study them until you understand that

    char word;

    might be confusing. (The thread title indicates you might wish to encrypt only a single letter at a time. In that case char might be a good data type, but the variable name word isn't well chosen. Humans care, the compiler won't care.)

    How do you treat lower case? Punctuation?
    Last edited by b49P23TIvg; November 23rd, 2012 at 12:22 PM.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo