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

    Join Date
    Nov 2012
    Rep Power

    Programing for encryption

    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'},
    {'Y','Q'},{'Z',' '},{' ','V'}};

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

    return 0;
  2. #2
  3. Contributing User

    Join Date
    Aug 2011
    Rep Power
    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 11:22 AM.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo