Simple Cipher Excersize

This is a discussion on Simple Cipher Excersize within the C Programming forums, part of the General Programming Boards category; Hey guys, I'm new to programming, as I've just started it as a hobby, and I'm attempting to create a ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    12

    Simple Cipher Excersize

    Hey guys, I'm new to programming, as I've just started it as a hobby, and I'm attempting to create a simple program which ciphers text for the user. The user inputs texts, and then the program offsets each letter, by a value, which is also decided by the user.

    So, if the offset value is set to 1, the word:

    Cipher

    becomes:

    Djqifs

    I'd like the program to be written as simply as possible, so that I can read it and try to create my own version. Many thanks guys! Keep up the good work!

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    That is called the Caesar cipher.

    What exactly do you need help with this sounds like a pretty straightforward program.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    12
    I'd like someone to have a go at writing the program, so that I can see how they went about it, and make one myself, and expand on it in the future... Any more details, just ask

  4. #4
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    I'd like someone to have a go at writing the program, so that I can see how they went about it, and make one myself, and expand on it in the future... Any more details, just ask
    No, tell us what you don't understand? We are not going to give you the code.
    Write down the logic before starting to code.
    and post the code[in code tag] if you have any problem.
    This looks like an assignment. Don't even think of that we'll do your work for you!

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    12
    Haha, okay, when I get to my pc, I'll try writing out some code, cheers guys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating very simple text editor using c
    By if13121 in forum C Programming
    Replies: 9
    Last Post: 10-19-2010, 06:26 PM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 04:42 PM
  3. Simple message encryption
    By Vicious in forum C++ Programming
    Replies: 10
    Last Post: 11-07-2004, 11:48 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  5. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21