Thread: Caesar encryption

  1. #16
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Code:
              if (un[i] == ' ')
                   en[i] = ' ';
              else
                   en[i] = (((un[i] - 'a') + offset) % 26) + 'a';
    If you understand what you're doing, you're not learning anything.

  2. #17
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #18
    Registered User
    Join Date
    Sep 2006
    Posts
    21
    Quote Originally Posted by itsme86
    Code:
              if (un[i] == ' ')
                   en[i] = ' ';
              else
                   en[i] = (((un[i] - 'a') + offset) % 26) + 'a';

    Allright, if string "un" contains characters besides the ones we're interested in encrypting - send them (space in this case) to string "en" as is. Got it!

    Thank, again :-)

    Code:
    Code:
    
    fflush(stdin);
    Don't use that:

    * FAQ > Explanations of... > Why fflush(stdin) is wrong
    * FAQ > How do I... (Level 2) > Flush the input buffer
    I will read the FAQ as soon as possible. I've only used fflush to make the screen stick after the program has run. But I'll check the FAQs

    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. help needed with edit control & encryption
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2006, 08:21 PM
  3. abt encryption algorithm
    By purIn in forum C Programming
    Replies: 9
    Last Post: 12-22-2003, 10:16 PM
  4. What's wrong with my Stream Cipher Encryption?
    By Davros in forum C++ Programming
    Replies: 3
    Last Post: 04-18-2002, 09:51 PM
  5. File Encryption & Read/Write in Binary Mode
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 06:45 PM