Find the answer to your Linux question:
Results 1 to 3 of 3
Sorry that the title is very vague, but I didn't know exactly how to title it. Either way, I am trying to make my own simple cryptography program, and I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! Vampire5's Avatar
    Join Date
    Jan 2012
    Posts
    22

    Question Character for loop


    Sorry that the title is very vague, but I didn't know exactly how to title it. Either way, I am trying to make my own simple cryptography program, and I need to allow the user to assign numbers to each character (I'm trying to include all characters if possible). Is there a way that I could use a for loop to do this without having to go through each character one by one. By the way, I am programming this in C++.

    Thanks!

  2. #2
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,305
    Presuming ascii it is quite simple. man ascii(7) will show you the conversion from decimal integer to ascii character. Loop through the range that interests you and cast the int to char.

  3. #3
    Just Joined! Vampire5's Avatar
    Join Date
    Jan 2012
    Posts
    22
    Thanks for the help! I know it was probably a stupid question to start with, but I really didn't want to write all the lines down. Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •