Thread: encrypting and decrypting assignment

  1. #1
    Registered User
    Join Date
    Apr 2017
    Posts
    2

    Question encrypting and decrypting assignment

    can someone please help me with this task plaese?

    " a. Write a function that accepts text until Enter is entered and encrypts letters as follows: Each letter is encrypted by a 2-digit number (a is encrypted by 01, b by 02 and so on ... z is encrypted by 26) and the numbers in the output are printed without Spaces between them. For example, a dog will be encrypted like this: 01041507. The function will ignore any character that is not a large or small Latin letter.
    B. There is a write function that decodes what is encoded in a. Ie its input will be digits (until Enter), so that each pair represents a Latin letter and the function prints it to the screen. It is assumed that the input is correct and each pair of digits is a number between 01 and 26. (Note that each pair of characters that represent digits must be converted into an int type)"

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,127
    We cannot and will not do the programming for you! YOU need to try to write an initial version of the code that we can comment on.

    The only way to learn the language, or any subject, is to do the work for yourself!

    Please read the Forum Rules FAQ!

    Your instructor should have given you all the information you need to do this assignment. I suspect your instructor taught you about many operators, including all the bitwise operators.
    Last edited by rstanley; 04-30-2017 at 09:42 AM.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    Just to be pedantic, that's encoding, not encryption.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Apr 2017
    Posts
    2
    i'm do not expect you to solve , i just want some help with the algorithm for the encoding

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    Well what do you know?

    - How to read a line of input from the user into a char array?
    - How to print each character in turn from an array of chars?
    - How to restrict the printing to match "The function will ignore any character that is not a large or small Latin letter."?

    It's a process of identifying incremental small steps towards your goal.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Decrypting Ciphertext
    By ubmattpangolin in forum General Discussions
    Replies: 11
    Last Post: 09-02-2016, 06:21 PM
  2. Replies: 12
    Last Post: 07-15-2010, 04:04 AM
  3. Encrypting/Decrypting file holding binary data
    By wayne08 in forum C Programming
    Replies: 9
    Last Post: 04-21-2010, 01:16 AM
  4. Require help decrypting XOR.
    By mkthnx001 in forum C++ Programming
    Replies: 15
    Last Post: 05-17-2009, 07:15 PM
  5. decrypting
    By cyberCLoWn in forum C++ Programming
    Replies: 11
    Last Post: 12-30-2003, 04:20 PM

Tags for this Thread